Skip to content

TST/CLN: Use fixtures instead of setup_method in tests/indexing #49157

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

Merged
merged 9 commits into from
Oct 22, 2022

Conversation

mroeschke
Copy link
Member

@mroeschke mroeschke added Testing pandas testing functions or related to the test suite Indexing Related to indexing on series/frames, not to indexes themselves Clean labels Oct 17, 2022
@mroeschke mroeschke added this to the 2.0 milestone Oct 17, 2022
@phofl phofl self-requested a review October 19, 2022 21:14
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

a few comments

d = {}
for typ in self._typs:
d[typ] = getattr(self, f"{kind}_{typ}")
def check_result(obj, method, key, axes=None, fails=None):
Copy link
Contributor

Choose a reason for hiding this comment

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

worth typing the args?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, typed the straightforward args

@@ -32,7 +32,7 @@
)
import pandas._testing as tm
from pandas.api.types import is_scalar
from pandas.tests.indexing.common import Base
from pandas.tests.indexing.common import check_result
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe rename to assert_result (or something slightly more verbose)

Copy link
Member Author

Choose a reason for hiding this comment

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

Renamed to check_indexing_smoketest_or_raises

self.check_result("loc", key, typs=typs, axes=axes, fails=KeyError)

def test_loc_getitem_label_list_fails(self):
@pytest.mark.parametrize("kind", ["series", "frame"])
Copy link
Contributor

Choose a reason for hiding this comment

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

fixture for the kind?

Copy link
Member Author

Choose a reason for hiding this comment

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

Don't think it's entirely worth it here. This is just used to combine with another string to fetch a fixture.

@jreback jreback merged commit 6c46013 into pandas-dev:main Oct 22, 2022
@jreback
Copy link
Contributor

jreback commented Oct 22, 2022

thanks @mroeschke

@mroeschke mroeschke deleted the cln/tst/indexing branch October 24, 2022 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean Indexing Related to indexing on series/frames, not to indexes themselves Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants