-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
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
Conversation
mroeschke
commented
Oct 17, 2022
- Tests added and passed if fixing a bug or adding a new feature
- All code checks passed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a few comments
pandas/tests/indexing/common.py
Outdated
d = {} | ||
for typ in self._typs: | ||
d[typ] = getattr(self, f"{kind}_{typ}") | ||
def check_result(obj, method, key, axes=None, fails=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
worth typing the args?
There was a problem hiding this comment.
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
pandas/tests/indexing/test_iloc.py
Outdated
@@ -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 |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixture for the kind?
There was a problem hiding this comment.
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.
thanks @mroeschke |