-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TST: expand tests for ExtensionArray setitem with nullable arrays #31741
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
TST: expand tests for ExtensionArray setitem with nullable arrays #31741
Conversation
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.
awesome!! Thanks for adding tests for it! @jorisvandenbossche
if box_in_series: | ||
data = pd.Series(data) | ||
|
||
with pytest.raises(IndexError): |
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 sure if an error message should be matched here and below?
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.
Added part of the message
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.
small comment, pls rebase as I think we merged something that might impact this (or maybe its open still, the string setitem change).
@pytest.mark.parametrize( | ||
"idx", | ||
[[0, 1, 2], pd.array([0, 1, 2], dtype="Int64"), np.array([0, 1, 2])], | ||
ids=["list", "integer-array", "numpy-array"], |
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.
labels should be: extension-integer-array, numpy-integer-array to be more informative
@@ -93,6 +93,90 @@ def test_setitem_iloc_scalar_multiple_homogoneous(self, data): | |||
df.iloc[10, 1] = data[1] | |||
assert df.loc[10, "B"] == data[1] | |||
|
|||
@pytest.mark.parametrize( |
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.
think about adding a new class here; these are specifically for setitem_mask (could be a followon)
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.
think about adding a new class here; these are specifically for setitem_mask (could be a followon)
In general, changing names is annoying for downstream consumers of those tests (this are the base extension tests), so not worth here I think
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.
ok, I don't buy your argument, these are experimental features where we actually to expand test coverage. its going to happen (but ok for now)
needs rebase |
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.
lgtm. @TomAugspurger
@@ -93,6 +93,90 @@ def test_setitem_iloc_scalar_multiple_homogoneous(self, data): | |||
df.iloc[10, 1] = data[1] | |||
assert df.loc[10, "B"] == data[1] | |||
|
|||
@pytest.mark.parametrize( |
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.
ok, I don't buy your argument, these are experimental features where we actually to expand test coverage. its going to happen (but ok for now)
Follow-up on #31484 to add some more test cases (eg also test the validation done in the
check_array_indexer
(wrong length, missing values), as well for nullable integer arrays), similarly to the tests I added for__getitem__
.cc @charlesdong1991