Skip to content
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

CLN/TST: clean logic of old datetime test_indexing test #55523

Merged
merged 1 commit into from
Oct 15, 2023

Conversation

jorisvandenbossche
Copy link
Member

Breaking off a change I had to make for #55428, because it's actually unrelated to CoW and reduces the diff there a little bit.

I think that this test has over time, through several small changes, become quite useful / incomprehensible. So cleaning it up, and actually asserting what my understanding is that it was originally testing.

Comment on lines -430 to +431
expected = ts["2001"]
expected.name = "A"
result = ts["2001"]
tm.assert_series_equal(result, ts.iloc[:12])
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This expected wasn't actually being used right now, and it's the result of the "getting" operation (with a timeseries partial indexing), so asserting the result instead.

Comment on lines 444 to +445
ts["2001"] = 1
expected = ts["2001"]
expected.name = "A"
tm.assert_series_equal(ts, expected)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly here, the result of setting ts["2001"] = 1 was no longer tested, and expected wasn't actually used

Comment on lines -447 to -448
with pytest.raises(KeyError, match="2001"):
df["2001"]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicated with 10 lines above

@mroeschke mroeschke added this to the 2.2 milestone Oct 15, 2023
@mroeschke mroeschke merged commit 10cf330 into pandas-dev:main Oct 15, 2023
35 checks passed
@mroeschke
Copy link
Member

Thanks @jorisvandenbossche

@jorisvandenbossche jorisvandenbossche deleted the cln-test branch October 17, 2023 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants