9
9
from .. import base
10
10
11
11
12
- @pytest .fixture (params = ['float' , 'object' ])
13
- def dtype (request ):
14
- return PandasDtype (np .dtype (request .param ))
15
-
16
-
17
12
@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
13
+ def dtype ():
14
+ return PandasDtype (np .dtype ('float' ))
37
15
38
16
39
17
@pytest .fixture
40
18
def data (allow_in_pandas , dtype ):
41
- if dtype .numpy_dtype == 'object' :
42
- return pd .Series ([(i ,) for i in range (100 )]).array
43
19
return PandasArray (np .arange (1 , 101 , dtype = dtype ._dtype ))
44
20
45
21
@@ -48,18 +24,6 @@ def data_missing(allow_in_pandas):
48
24
return PandasArray (np .array ([np .nan , 1.0 ]))
49
25
50
26
51
- @pytest .fixture
52
- def na_value ():
53
- return np .nan
54
-
55
-
56
- @pytest .fixture
57
- def na_cmp ():
58
- def cmp (a , b ):
59
- return np .isnan (a ) and np .isnan (b )
60
- return cmp
61
-
62
-
63
27
@pytest .fixture
64
28
def data_for_sorting (allow_in_pandas ):
65
29
"""Length-3 array with a known sort order.
@@ -152,19 +116,6 @@ class TestArithmetics(BaseNumPyTests, base.BaseArithmeticOpsTests):
152
116
frame_scalar_exc = None
153
117
series_array_exc = None
154
118
155
- def _check_op (self , s , op , other , op_name , exc = NotImplementedError ):
156
- if s .dtype == 'object' :
157
- raise pytest .skip ("Skipping for object dtype." )
158
- super (TestArithmetics , self )._check_op (s , op , other , op_name , exc )
159
-
160
- def _check_divmod_op (self , s , op , other , exc = Exception ):
161
- if isinstance (s , pd .Series ) and s .dtype == 'object' :
162
- raise pytest .skip ("Skipping for object dtype." )
163
- elif isinstance (other , pd .Series ) and other .dtype == 'object' :
164
- raise pytest .skip ("Skipping for object dtype." )
165
-
166
- super (TestArithmetics , self )._check_divmod_op (s , op , other , exc )
167
-
168
119
def test_divmod_series_array (self , data ):
169
120
s = pd .Series (data )
170
121
self ._check_divmod_op (s , divmod , data , exc = None )
@@ -201,24 +152,17 @@ class TestPrinting(BaseNumPyTests, base.BasePrintingTests):
201
152
class TestNumericReduce (BaseNumPyTests , base .BaseNumericReduceTests ):
202
153
203
154
def check_reduce (self , s , op_name , skipna ):
204
- if s .dtype == 'object' :
205
- raise pytest .skip ("Skipping for object dtype." )
206
155
result = getattr (s , op_name )(skipna = skipna )
207
156
# avoid coercing int -> float. Just cast to the actual numpy type.
208
157
expected = getattr (s .astype (s .dtype ._dtype ), op_name )(skipna = skipna )
209
158
tm .assert_almost_equal (result , expected )
210
159
211
160
212
161
class TestBooleanReduce (BaseNumPyTests , base .BaseBooleanReduceTests ):
213
-
214
- def check_reduce (self , s , op_name , skipna ):
215
- if s .dtype == 'object' :
216
- raise pytest .skip ("Skipping for object dtype." )
217
-
218
- super (TestBooleanReduce , self ).check_reduce (s , op_name , skipna )
162
+ pass
219
163
220
164
221
- class TestMissing (BaseNumPyTests , base .BaseMissingTests ):
165
+ class TestMising (BaseNumPyTests , base .BaseMissingTests ):
222
166
pass
223
167
224
168
0 commit comments