-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Test nested PandasArray #24993
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
Test nested PandasArray #24993
Changes from 3 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
558cdbe
REF: Move numpy tests down a directory
TomAugspurger 38e7413
The fix
TomAugspurger 9122bb6
implement skips
TomAugspurger 86948a1
fixed skip message
TomAugspurger afb1bee
Merge remote-tracking branch 'upstream/master' into 24986-nested-array
TomAugspurger 642b01a
py2 compat
TomAugspurger 518315c
seperate file
TomAugspurger 6d7e0d8
remove duplicate fixtures
TomAugspurger bf1efc9
Skip for old NumPy
TomAugspurger cc246c9
comment
TomAugspurger bea8de0
Merge remote-tracking branch 'upstream/master' into 24986-nested-array
TomAugspurger 7cf5583
Update pandas/tests/extension/numpy_/conftest.py
jorisvandenbossche 358df86
Update test_numpy_nested.py
TomAugspurger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import pytest | ||
|
||
# A set of Base EA tests that are know to not work for | ||
# the object-dtype PandasArray holding nested data. | ||
skips = { | ||
'BaseCastingTests.test_astype_str', | ||
'BaseConstructorsTests.test_array_from_scalars', | ||
# tuple isn't instance of np.object | ||
'BaseGetitemTests.test_getitem_scalar', | ||
# Can't pass tuples to _from_sequence | ||
'BaseGetitemTests.test_take_series', | ||
# np.array shape inference | ||
'BaseInterfaceTests.test_array_interface', | ||
# Can't construct expected. | ||
'BaseMethodsTests.test_unique', | ||
'BaseMethodsTests.test_combine_add', | ||
'BaseMethodsTests.test_shift_fill_value', | ||
'BaseMethodsTests.test_where_series', | ||
'BaseMethodsTests.test_repeat', | ||
# Can't hash ndarray[tuple] | ||
'BaseMethodsTests.test_hash_pandas_object_works', | ||
# Can't construct expected. | ||
'BaseReshapingTests.test_merge', | ||
'BaseReshapingTests.test_merge_on_extension_array', | ||
'BaseReshapingTests.test_merge_on_extension_array_duplicates', | ||
|
||
# ndarray setting | ||
'BaseSetitemTests.test_setitem_scalar_series', | ||
'BaseSetitemTests.test_setitem_sequence', | ||
'BaseSetitemTests.test_setitem_sequence_mismatched_length_raises', | ||
'BaseSetitemTests.test_setitem_sequence_broadcasts', | ||
'BaseSetitemTests.test_setitem_sequence_broadcasts', | ||
'BaseSetitemTests.test_setitem_loc_scalar_mixed', | ||
'BaseSetitemTests.test_setitem_iloc_scalar_mixed', | ||
'BaseSetitemTests.test_setitem_loc_scalar_multiple_homogoneous', | ||
'BaseSetitemTests.test_setitem_iloc_scalar_multiple_homogoneous', | ||
'BaseSetitemTests.test_setitem_mask_broadcast', | ||
'BaseSetitemTests.test_setitem_scalar_key_sequence_raise', | ||
|
||
'BaseParsingTests.test_EA_types', | ||
} | ||
|
||
|
||
def pytest_collection_modifyitems(config, items): | ||
skip = pytest.mark.skip(reason="Skipping this because ...") | ||
for item in items: | ||
# TODO: See if pytest has a better way to resolve the *value* | ||
# supplied to a fixture. Right now .keywords gets things | ||
# like 'object' or 'data-object'. | ||
parts = item.name.split("[") | ||
if (len(parts) > 1 and 'object' in item.name.split('[')[1] | ||
and item.obj.__qualname__ in skips): | ||
item.add_marker(skip) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I'd be eager to hear of a better way to do this. Right now, we rely on the name being like
TestMethods::test_where_series[object-True]
do determine if we should skip. Not the cleanest. Ideally we would be able to resolve that to the actual value, but pytest may not have that yet.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.
@simonjayhawkins any thoughts here
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.
@TomAugspurger why don't you just add a marker to specific tests? (and skip on that)
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.
I'm not aware of a way for a test marker to get access to the value of another 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.
IIUC, from a test or fixture you get the value supplied to the fixture by including that (used by) fixture in the function signature. seems to work...
https://github.com/simonjayhawkins/pandas/blob/6ebf2c52d8925663a9242d3c58a069000b2c3f06/pandas/tests/io/formats/conftest.py#L141-L146
that would mean changing all the tests individually though. so this may not be what your after.