Make *_range functions consistent
- [X] closes #17471
- [X] tests added / passed
- [X] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [X] whatsnew entry

Comments:

- I couldn't find any existing tests of `period_range`, so I created a new file `test_period_range.py` in a similar fashion to the existing files `test_date_range.py` and `test_timedelta_range.py`.
- Cleaned up a few existing tests relevant to this issue (used `with` context where appropriate, etc.).