-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
CLN: Remove some duplicated tests and parametrize #39960
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
pandas/tests/indexing/test_iloc.py
Outdated
@@ -35,28 +35,12 @@ | |||
|
|||
|
|||
class TestiLoc(Base): | |||
def test_iloc_getitem_int(self): | |||
@pytest.mark.parametrize("key", [2, -1, [0, 1, 2]]) | |||
def test_iloc_getitem_int(self, key): |
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.
rename since it is no longer just int keys?
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.
Done
pandas/tests/indexing/test_loc.py
Outdated
@@ -762,7 +756,8 @@ def test_loc_coercion(self): | |||
result = df.iloc[3:] | |||
tm.assert_series_equal(result.dtypes, expected) | |||
|
|||
def test_setitem_new_key_tz(self): | |||
@pytest.mark.parametrize("indexer", [tm.setitem, tm.loc]) |
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 this is indexer_sl
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.
Thx, did not know that
pandas/tests/indexing/test_loc.py
Outdated
timedelta_range(start="1 day", end="2 days", freq="1H"), | ||
], | ||
) | ||
def test_loc_getitem_label_slice_period(self, ix): |
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.
rename to not period-specific?
is there a corresponding dt64 test that should be rolled into this?
call it index
instead of ix
?
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.
Done
@@ -507,30 +507,22 @@ def test_floating_misc(self): | |||
# label based slicing | |||
result1 = s[1.0:3.0] | |||
result2 = s.loc[1.0:3.0] | |||
result3 = s.loc[1.0:3.0] |
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.
not necessarily for this PR, but i think this test can be parametrized over indexer_sl
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.
Yes, good point. Was too focused on the duplicates :)
pandas/tests/indexing/test_floats.py
Outdated
@@ -498,122 +498,72 @@ def test_floating_index_doc_example(self): | |||
assert s.loc[3] == 2 | |||
assert s.iloc[3] == 3 | |||
|
|||
def test_floating_misc(self): | |||
@pytest.mark.parametrize("indexer_sl", [tm.getitem, tm.loc]) |
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.
you dont need to parametrize since indexer_sl is a fixture
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.
Thx, did not get that :(
pandas/tests/indexing/test_loc.py
Outdated
@@ -762,7 +756,8 @@ def test_loc_coercion(self): | |||
result = df.iloc[3:] | |||
tm.assert_series_equal(result.dtypes, expected) | |||
|
|||
def test_setitem_new_key_tz(self): | |||
@pytest.mark.parametrize("indexer_sl", [tm.setitem, tm.loc]) |
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.
ditto, indexer_sl is a fixture
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.
Done
couple comments, ping on green |
ping @jbrockmendel green |
thanks @phofl |
There were a few duplicates from the ix removal