Added tests for period str and repr.
- [x] closes #53000
- [x] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
All set - Ready for review @MarcoGorelli ! Thanks @MarcoGorelli for the quick review ! We can now proceed with #51459 , I updated the PR.