@@ -107,6 +107,16 @@ def test_getitem_scalar(self, data):
107
107
"""
108
108
super ().test_getitem_scalar (data )
109
109
110
+ def test_take_pandas_style_negative_raises (self , data , na_value ):
111
+ # This test was failing compliance checks because it attempted to match
112
+ # a pytest regex match using an empty string (""), which pytest version
113
+ # 8.4.0 stopped allowing.
114
+ # The test has been updated in pandas main so that it will
115
+ # no longer fail, but the fix is not expected to be released until
116
+ # at least pandas version 3.0 (current version is 2.3).
117
+ with pytest .raises (ValueError ):
118
+ data .take ([0 , - 2 ], fill_value = na_value , allow_fill = True )
119
+
110
120
111
121
class TestJSONArrayIndex (base .BaseIndexTests ):
112
122
pass
@@ -133,6 +143,26 @@ def test_array_interface(self, data):
133
143
def test_view (self , data ):
134
144
super ().test_view (data )
135
145
146
+ def test_array_interface_copy (self , data ):
147
+ # This test was failing compliance checks due to changes in how
148
+ # numpy handles processing when np.array(obj, copy=False).
149
+ # Until pandas changes the existing tests, this compliance test
150
+ # will continue to fail.
151
+ import numpy as np
152
+ from pandas .compat .numpy import np_version_gt2
153
+
154
+ result_copy1 = np .array (data , copy = True )
155
+ result_copy2 = np .array (data , copy = True )
156
+ assert not np .may_share_memory (result_copy1 , result_copy2 )
157
+
158
+ if not np_version_gt2 :
159
+ # copy=False semantics are only supported in NumPy>=2.
160
+ return
161
+
162
+ result_nocopy1 = np .array (data , copy = False )
163
+ result_nocopy2 = np .array (data , copy = False )
164
+ assert not np .may_share_memory (result_nocopy1 , result_nocopy2 )
165
+
136
166
137
167
class TestJSONArrayParsing (base .BaseParsingTests ):
138
168
@pytest .mark .xfail (reason = "data type 'json' not understood" )
@@ -190,6 +220,21 @@ def test_sort_values(self, data_for_sorting):
190
220
def test_sort_values_frame (self , data_for_sorting ):
191
221
super ().test_sort_values_frame (data_for_sorting )
192
222
223
+ def test_argmax_argmin_no_skipna_notimplemented (self , data_missing_for_sorting ):
224
+ # This test was failing compliance checks because it attempted to match
225
+ # a pytest regex match using an empty string (""), which pytest version
226
+ # 8.4.0 stopped allowing.
227
+ # The test has been updated in pandas main so that it will
228
+ # no longer fail, but the fix is not expected to be released until
229
+ # at least pandas version 3.0 (current version is 2.3)
230
+ data = data_missing_for_sorting
231
+
232
+ with pytest .raises (NotImplementedError ):
233
+ data .argmin (skipna = False )
234
+
235
+ with pytest .raises (NotImplementedError ):
236
+ data .argmax (skipna = False )
237
+
193
238
194
239
class TestJSONArrayMissing (base .BaseMissingTests ):
195
240
@pytest .mark .xfail (reason = "Setting a dict as a scalar" )
@@ -239,7 +284,20 @@ class TestJSONArrayPrinting(base.BasePrintingTests):
239
284
240
285
241
286
class TestJSONArrayReduce (base .BaseReduceTests ):
242
- pass
287
+ @pytest .mark .filterwarnings ("ignore::RuntimeWarning" )
288
+ @pytest .mark .parametrize ("skipna" , [True , False ])
289
+ def test_reduce_series_numeric (self , data , all_numeric_reductions , skipna ):
290
+ op_name = all_numeric_reductions
291
+ ser = pd .Series (data )
292
+
293
+ if not self ._supports_reduction (ser , op_name ):
294
+ # Sum does not raise an Error (TypeError or otherwise)
295
+ if op_name != "sum" :
296
+ with pytest .raises (TypeError ):
297
+ getattr (ser , op_name )(skipna = skipna )
298
+ else :
299
+ # min/max with empty produce numpy warnings
300
+ self .check_reduce (ser , op_name , skipna )
243
301
244
302
245
303
class TestJSONArrayReshaping (base .BaseReshapingTests ):
@@ -356,6 +414,19 @@ def test_setitem_mask_boolean_array_with_na(self, data, box_in_series):
356
414
def test_setitem_preserves_views (self , data ):
357
415
super ().test_setitem_preserves_views (data )
358
416
417
+ def test_setitem_invalid (self , data , invalid_scalar ):
418
+ # This test was failing compliance checks because it attempted to match
419
+ # a pytest regex match using an empty string (""), which pytest version
420
+ # 8.4.0 stopped allowing.
421
+ # The test has been updated in pandas main so that it will
422
+ # no longer fail, but the fix is not expected to be released until
423
+ # at least pandas version 3.0 (current version is 2.3)
424
+ with pytest .raises ((ValueError , TypeError )):
425
+ data [0 ] = invalid_scalar
426
+
427
+ with pytest .raises ((ValueError , TypeError )):
428
+ data [:] = invalid_scalar
429
+
359
430
360
431
class TestJSONArrayDim2Compat (base .Dim2CompatTests ):
361
432
pass
0 commit comments