TST: find solution for extension/tests_numpy.py (PandasArray base extension tests) #40021
Labels
ExtensionArray
Extending pandas with custom dtypes or arrays.
Testing
pandas testing functions or related to the test suite
We currently run the base extension tests also for the
PandasArray
(to have coverage of this array class), but because we actually don't allow to store this in a Series/DataFrame, the tests do some patching to workaround this:pandas/pandas/tests/extension/test_numpy.py
Lines 36 to 54 in dec7d21
However, this regularly gives problems, see eg #39991 (comment) or #39722 (comment), where for some reason those PandasArrays do / don't get preserved in a DataFrame/Series due to some other code changes that impact this, and the tests are not written to deal with it.
(one example:
extract_array
will convert a pandas Series with numpy dtype into a PandasArray, when the patch is enabled. This can then cause the result to include the PandasArray EA, while the expected result is not created that way)So we should try to find a solution for this (as it gets quite annoying to deal with it just to get those tests passing). But I don't directly know what the best solution would be.
Some ideas:
tests/extension/test_numpy.py
and thus don't run the base extension interface tests for PandasArray. We still havetests/arrays/test_numpy.py
for some other tests. The easiest solution, but would also remove test coverage.tests/extension/test_numpy.py
that only deal with the array, and not with the array stored in DataFrame/Series.cc @TomAugspurger @jbrockmendel
The text was updated successfully, but these errors were encountered: