99from .. import base
1010
1111
12- @pytest .fixture (params = ['float' , 'object' ])
13- def dtype (request ):
14- return PandasDtype (np .dtype (request .param ))
15-
16-
1712@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' ))
3715
3816
3917@pytest .fixture
4018def data (allow_in_pandas , dtype ):
41- if dtype .numpy_dtype == 'object' :
42- return pd .Series ([(i ,) for i in range (100 )]).array
4319 return PandasArray (np .arange (1 , 101 , dtype = dtype ._dtype ))
4420
4521
@@ -48,18 +24,6 @@ def data_missing(allow_in_pandas):
4824 return PandasArray (np .array ([np .nan , 1.0 ]))
4925
5026
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-
6327@pytest .fixture
6428def data_for_sorting (allow_in_pandas ):
6529 """Length-3 array with a known sort order.
@@ -152,19 +116,6 @@ class TestArithmetics(BaseNumPyTests, base.BaseArithmeticOpsTests):
152116 frame_scalar_exc = None
153117 series_array_exc = None
154118
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-
168119 def test_divmod_series_array (self , data ):
169120 s = pd .Series (data )
170121 self ._check_divmod_op (s , divmod , data , exc = None )
@@ -201,24 +152,17 @@ class TestPrinting(BaseNumPyTests, base.BasePrintingTests):
201152class TestNumericReduce (BaseNumPyTests , base .BaseNumericReduceTests ):
202153
203154 def check_reduce (self , s , op_name , skipna ):
204- if s .dtype == 'object' :
205- raise pytest .skip ("Skipping for object dtype." )
206155 result = getattr (s , op_name )(skipna = skipna )
207156 # avoid coercing int -> float. Just cast to the actual numpy type.
208157 expected = getattr (s .astype (s .dtype ._dtype ), op_name )(skipna = skipna )
209158 tm .assert_almost_equal (result , expected )
210159
211160
212161class 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
219163
220164
221- class TestMissing (BaseNumPyTests , base .BaseMissingTests ):
165+ class TestMising (BaseNumPyTests , base .BaseMissingTests ):
222166 pass
223167
224168
0 commit comments