|
23 | 23 | ExtensionDtype, |
24 | 24 | PandasDtype, |
25 | 25 | ) |
26 | | -from pandas.core.dtypes.generic import ABCPandasArray |
27 | 26 |
|
28 | 27 | import pandas as pd |
29 | 28 | import pandas._testing as tm |
30 | 29 | from pandas.core.arrays.numpy_ import PandasArray |
31 | | -from pandas.core.internals import ( |
32 | | - blocks, |
33 | | - managers, |
34 | | -) |
| 30 | +from pandas.core.internals import blocks |
35 | 31 | from pandas.tests.extension import base |
36 | 32 |
|
37 | 33 | # TODO(ArrayManager) PandasArray |
38 | 34 | pytestmark = td.skip_array_manager_not_yet_implemented |
39 | 35 |
|
40 | 36 |
|
41 | | -def _extract_array_patched(obj): |
42 | | - if isinstance(obj, (pd.Index, pd.Series)): |
43 | | - obj = obj._values |
44 | | - if isinstance(obj, ABCPandasArray): |
45 | | - # TODO for reasons unclear, we get here in a couple of tests |
46 | | - # with PandasArray._typ *not* patched |
47 | | - obj = obj.to_numpy() |
48 | | - |
49 | | - return obj |
50 | | - |
51 | | - |
52 | 37 | def _can_hold_element_patched(obj, element) -> bool: |
53 | 38 | if isinstance(element, PandasArray): |
54 | 39 | element = element.to_numpy() |
@@ -98,7 +83,6 @@ def allow_in_pandas(monkeypatch): |
98 | 83 | """ |
99 | 84 | with monkeypatch.context() as m: |
100 | 85 | m.setattr(PandasArray, "_typ", "extension") |
101 | | - m.setattr(managers, "_extract_array", _extract_array_patched) |
102 | 86 | m.setattr(blocks, "can_hold_element", _can_hold_element_patched) |
103 | 87 | m.setattr(tm.asserters, "assert_attr_equal", _assert_attr_equal) |
104 | 88 | yield |
|
0 commit comments