Skip to content

Commit 0c9ad00

Browse files
revert changes to tests in pandas-devgh-24993
1 parent bb43726 commit 0c9ad00

File tree

4 files changed

+35
-325
lines changed

4 files changed

+35
-325
lines changed

pandas/tests/extension/numpy_/__init__.py

Whitespace-only changes.

pandas/tests/extension/numpy_/conftest.py

-38
This file was deleted.

pandas/tests/extension/numpy_/test_numpy_nested.py

-286
This file was deleted.

pandas/tests/extension/numpy_/test_numpy.py renamed to pandas/tests/extension/test_numpy.py

+35-1
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,36 @@
66
from pandas.core.arrays.numpy_ import PandasArray, PandasDtype
77
import pandas.util.testing as tm
88

9-
from .. import base
9+
from . import base
1010

1111

1212
@pytest.fixture
1313
def dtype():
1414
return PandasDtype(np.dtype('float'))
1515

1616

17+
@pytest.fixture
18+
def allow_in_pandas(monkeypatch):
19+
"""
20+
A monkeypatch to tells pandas to let us in.
21+
22+
By default, passing a PandasArray to an index / series / frame
23+
constructor will unbox that PandasArray to an ndarray, and treat
24+
it as a non-EA column. We don't want people using EAs without
25+
reason.
26+
27+
The mechanism for this is a check against ABCPandasArray
28+
in each constructor.
29+
30+
But, for testing, we need to allow them in pandas. So we patch
31+
the _typ of PandasArray, so that we evade the ABCPandasArray
32+
check.
33+
"""
34+
with monkeypatch.context() as m:
35+
m.setattr(PandasArray, '_typ', 'extension')
36+
yield
37+
38+
1739
@pytest.fixture
1840
def data(allow_in_pandas, dtype):
1941
return PandasArray(np.arange(1, 101, dtype=dtype._dtype))
@@ -24,6 +46,18 @@ def data_missing(allow_in_pandas):
2446
return PandasArray(np.array([np.nan, 1.0]))
2547

2648

49+
@pytest.fixture
50+
def na_value():
51+
return np.nan
52+
53+
54+
@pytest.fixture
55+
def na_cmp():
56+
def cmp(a, b):
57+
return np.isnan(a) and np.isnan(b)
58+
return cmp
59+
60+
2761
@pytest.fixture
2862
def data_for_sorting(allow_in_pandas):
2963
"""Length-3 array with a known sort order.

0 commit comments

Comments
 (0)