@@ -167,7 +167,7 @@ def test_numeric_compat(self, simple_index):
167
167
# we can remove multi.test_compat.test_numeric_compat
168
168
assert not isinstance (idx , MultiIndex )
169
169
if type (idx ) is Index :
170
- return
170
+ pytest . skip ( "Not applicable for Index" )
171
171
if is_numeric_dtype (simple_index .dtype ) or isinstance (
172
172
simple_index , TimedeltaIndex
173
173
):
@@ -246,9 +246,10 @@ def test_ensure_copied_data(self, index):
246
246
# Needs "freq" specification:
247
247
init_kwargs ["freq" ] = index .freq
248
248
elif isinstance (index , (RangeIndex , MultiIndex , CategoricalIndex )):
249
- # RangeIndex cannot be initialized from data
250
- # MultiIndex and CategoricalIndex are tested separately
251
- return
249
+ pytest .skip (
250
+ "RangeIndex cannot be initialized from data, "
251
+ "MultiIndex and CategoricalIndex are tested separately"
252
+ )
252
253
elif index .dtype == object and index .inferred_type == "boolean" :
253
254
init_kwargs ["dtype" ] = index .dtype
254
255
@@ -319,9 +320,8 @@ def test_memory_usage(self, index):
319
320
assert result3 > result2
320
321
321
322
def test_argsort (self , index ):
322
- # separately tested
323
323
if isinstance (index , CategoricalIndex ):
324
- return
324
+ pytest . skip ( f" { type ( self ). __name__ } separately tested" )
325
325
326
326
result = index .argsort ()
327
327
expected = np .array (index ).argsort ()
@@ -400,7 +400,7 @@ def test_insert_base(self, index):
400
400
result = index [1 :4 ]
401
401
402
402
if not len (index ):
403
- return
403
+ pytest . skip ( "Not applicable for empty index" )
404
404
405
405
# test 0th element
406
406
assert index [0 :4 ].equals (result .insert (0 , index [0 ]))
@@ -434,11 +434,11 @@ def test_insert_out_of_bounds(self, index):
434
434
435
435
def test_delete_base (self , index ):
436
436
if not len (index ):
437
- return
437
+ pytest . skip ( "Not applicable for empty index" )
438
438
439
439
if isinstance (index , RangeIndex ):
440
440
# tested in class
441
- return
441
+ pytest . skip ( f" { type ( self ). __name__ } tested elsewhere" )
442
442
443
443
expected = index [1 :]
444
444
result = index .delete (0 )
@@ -458,9 +458,7 @@ def test_delete_base(self, index):
458
458
@pytest .mark .filterwarnings (r"ignore:PeriodDtype\[B\] is deprecated:FutureWarning" )
459
459
def test_equals (self , index ):
460
460
if isinstance (index , IntervalIndex ):
461
- # IntervalIndex tested separately, the index.equals(index.astype(object))
462
- # fails for IntervalIndex
463
- return
461
+ pytest .skip (f"{ type (index ).__name__ } tested elsewhere" )
464
462
465
463
is_ea_idx = type (index ) is Index and not isinstance (index .dtype , np .dtype )
466
464
@@ -566,12 +564,11 @@ def test_format_empty(self, simple_index):
566
564
def test_fillna (self , index ):
567
565
# GH 11343
568
566
if len (index ) == 0 :
569
- return
567
+ pytest . skip ( "Not relevant for empty index" )
570
568
elif index .dtype == bool :
571
- # can't hold NAs
572
- return
569
+ pytest .skip (f"{ index .dtype } cannot hold NAs" )
573
570
elif isinstance (index , Index ) and is_integer_dtype (index .dtype ):
574
- return
571
+ pytest . skip ( f"Not relevant for Index with { index . dtype } " )
575
572
elif isinstance (index , MultiIndex ):
576
573
idx = index .copy (deep = True )
577
574
msg = "isna is not defined for MultiIndex"
@@ -654,15 +651,9 @@ def test_map(self, simple_index):
654
651
],
655
652
)
656
653
@pytest .mark .filterwarnings (r"ignore:PeriodDtype\[B\] is deprecated:FutureWarning" )
657
- def test_map_dictlike (self , mapper , simple_index ):
654
+ def test_map_dictlike (self , mapper , simple_index , request ):
658
655
idx = simple_index
659
- if isinstance (idx , CategoricalIndex ):
660
- # FIXME: this fails with CategoricalIndex bc it goes through
661
- # Categorical.map which ends up calling get_indexer with
662
- # non-unique values, which raises. This _should_ work fine for
663
- # CategoricalIndex.
664
- pytest .skip (f"skipping tests for { type (idx )} " )
665
- elif isinstance (idx , (DatetimeIndex , TimedeltaIndex , PeriodIndex )):
656
+ if isinstance (idx , (DatetimeIndex , TimedeltaIndex , PeriodIndex )):
666
657
pytest .skip ("Tested elsewhere." )
667
658
668
659
identity = mapper (idx .values , idx )
0 commit comments