Skip to content

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

Closed
@smarie

Description

@smarie

@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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs TestsUnit test(s) needed to prevent regressionsOutput-Formatting__repr__ of pandas objects, to_stringPeriodPeriod data type

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions