Skip to content

TST: Add tests for repr(pd.Period) #53000

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
smarie opened this issue Apr 29, 2023 · 0 comments · Fixed by #53003
Closed

TST: Add tests for repr(pd.Period) #53000

smarie opened this issue Apr 29, 2023 · 0 comments · Fixed by #53003
Labels
Needs Tests Unit test(s) needed to prevent regressions Output-Formatting __repr__ of pandas objects, to_string Period Period data type

Comments

@smarie
Copy link
Contributor

smarie commented Apr 29, 2023

@MarcoGorelli suggested in #51459 (review) to add more tests for Period repr before #51459 can be merged.

What I'm most concerned about is that not all these reprs seems to be explicitly tested for. Some of them are, e.g.

def test_millisecond_repr(self):
p = Period("2000-01-01 12:15:02.123")
assert repr(p) == "Period('2000-01-01 12:15:02.123', 'L')"
def test_microsecond_repr(self):
p = Period("2000-01-01 12:15:02.123567")
assert repr(p) == "Period('2000-01-01 12:15:02.123567', 'U')"

but then FR_SEC isn't (as far as I can tell).

Reckon we should add such unit tests for each period group (perhaps in a separate PR, which we could get in very quickly)? That would give me much more confidence about merging this

smarie pushed a commit to smarie/pandas that referenced this issue Apr 29, 2023
@rhshadrach rhshadrach changed the title Add tests for repr(pd.Period) TST: Add tests for repr(pd.Period) May 2, 2023
@rhshadrach rhshadrach added Output-Formatting __repr__ of pandas objects, to_string Period Period data type Needs Tests Unit test(s) needed to prevent regressions labels May 2, 2023
MarcoGorelli pushed a commit that referenced this issue May 5, 2023
* Added tests for period str and repr. Fixes #53000

* Removed commented params in test, improved test for repr, and blackened.

* Better tests

* Moved the two independent tests into parametrized test

---------

Co-authored-by: Sylvain MARIE <[email protected]>
topper-123 pushed a commit to topper-123/pandas that referenced this issue May 7, 2023
* Added tests for period str and repr. Fixes pandas-dev#53000

* Removed commented params in test, improved test for repr, and blackened.

* Better tests

* Moved the two independent tests into parametrized test

---------

Co-authored-by: Sylvain MARIE <[email protected]>
Rylie-W pushed a commit to Rylie-W/pandas that referenced this issue May 19, 2023
* Added tests for period str and repr. Fixes pandas-dev#53000

* Removed commented params in test, improved test for repr, and blackened.

* Better tests

* Moved the two independent tests into parametrized test

---------

Co-authored-by: Sylvain MARIE <[email protected]>
Daquisu pushed a commit to Daquisu/pandas that referenced this issue Jul 8, 2023
* Added tests for period str and repr. Fixes pandas-dev#53000

* Removed commented params in test, improved test for repr, and blackened.

* Better tests

* Moved the two independent tests into parametrized test

---------

Co-authored-by: Sylvain MARIE <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Tests Unit test(s) needed to prevent regressions Output-Formatting __repr__ of pandas objects, to_string Period Period data type
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants