@@ -122,10 +122,7 @@ class TestInterface(BaseDecimal, base.BaseInterfaceTests):
122
122
123
123
124
124
class TestConstructors (BaseDecimal , base .BaseConstructorsTests ):
125
- @pytest .mark .skip (reason = "not implemented constructor from dtype" )
126
- def test_from_dtype (self , data ):
127
- # construct from our dtype & string dtype
128
- pass
125
+ pass
129
126
130
127
131
128
class TestReshaping (BaseDecimal , base .BaseReshapingTests ):
@@ -168,20 +165,32 @@ class TestBooleanReduce(Reduce, base.BaseBooleanReduceTests):
168
165
169
166
class TestMethods (BaseDecimal , base .BaseMethodsTests ):
170
167
@pytest .mark .parametrize ("dropna" , [True , False ])
171
- @pytest .mark .xfail (reason = "value_counts not implemented yet." )
172
- def test_value_counts (self , all_data , dropna ):
168
+ def test_value_counts (self , all_data , dropna , request ):
169
+ if any (x != x for x in all_data ):
170
+ mark = pytest .mark .xfail (
171
+ reason = "tm.assert_series_equal incorrectly raises" ,
172
+ raises = AssertionError ,
173
+ )
174
+ request .node .add_marker (mark )
175
+
173
176
all_data = all_data [:10 ]
174
177
if dropna :
175
178
other = np .array (all_data [~ all_data .isna ()])
176
179
else :
177
180
other = all_data
178
181
179
- result = pd .Series (all_data ).value_counts (dropna = dropna ).sort_index ()
180
- expected = pd .Series (other ).value_counts (dropna = dropna ).sort_index ()
182
+ vcs = pd .Series (all_data ).value_counts (dropna = dropna )
183
+ vcs_ex = pd .Series (other ).value_counts (dropna = dropna )
184
+
185
+ with decimal .localcontext () as ctx :
186
+ # avoid raising when comparing Decimal("NAN") < Decimal(2)
187
+ ctx .traps [decimal .InvalidOperation ] = False
188
+
189
+ result = vcs .sort_index ()
190
+ expected = vcs_ex .sort_index ()
181
191
182
192
tm .assert_series_equal (result , expected )
183
193
184
- @pytest .mark .xfail (reason = "value_counts not implemented yet." )
185
194
def test_value_counts_with_normalize (self , data ):
186
195
return super ().test_value_counts_with_normalize (data )
187
196
@@ -191,13 +200,12 @@ class TestCasting(BaseDecimal, base.BaseCastingTests):
191
200
192
201
193
202
class TestGroupby (BaseDecimal , base .BaseGroupbyTests ):
194
- @ pytest . mark . xfail (
195
- reason = "needs to correctly define __eq__ to handle nans, xref #27081."
196
- )
197
- def test_groupby_apply_identity ( self , data_for_grouping ):
203
+ def test_groupby_apply_identity ( self , data_for_grouping , request ):
204
+ if any ( x != x for x in data_for_grouping ):
205
+ mark = pytest . mark . xfail ( reason = "tm.assert_series_equal raises incorrectly" )
206
+ request . node . add_marker ( mark )
198
207
super ().test_groupby_apply_identity (data_for_grouping )
199
208
200
- @pytest .mark .xfail (reason = "GH#39098: Converts agg result to object" )
201
209
def test_groupby_agg_extension (self , data_for_grouping ):
202
210
super ().test_groupby_agg_extension (data_for_grouping )
203
211
0 commit comments