@@ -549,6 +549,7 @@ def test_is_bool_dtype():
549
549
assert com .is_bool_dtype (pd .Index ([True , False ]))
550
550
551
551
552
+ @pytest .mark .filterwarnings ("ignore:'is_extension_type' is deprecated:FutureWarning" )
552
553
@pytest .mark .parametrize (
553
554
"check_scipy" , [False , pytest .param (True , marks = td .skip_if_no_scipy )]
554
555
)
@@ -573,6 +574,35 @@ def test_is_extension_type(check_scipy):
573
574
assert not com .is_extension_type (scipy .sparse .bsr_matrix ([1 , 2 , 3 ]))
574
575
575
576
577
+ def test_is_extension_type_deprecation ():
578
+ with tm .assert_produces_warning (FutureWarning ):
579
+ com .is_extension_type ([1 , 2 , 3 ])
580
+
581
+
582
+ @pytest .mark .parametrize (
583
+ "check_scipy" , [False , pytest .param (True , marks = td .skip_if_no_scipy )]
584
+ )
585
+ def test_is_extension_array_dtype (check_scipy ):
586
+ assert not com .is_extension_array_dtype ([1 , 2 , 3 ])
587
+ assert not com .is_extension_array_dtype (np .array ([1 , 2 , 3 ]))
588
+ assert not com .is_extension_array_dtype (pd .DatetimeIndex ([1 , 2 , 3 ]))
589
+
590
+ cat = pd .Categorical ([1 , 2 , 3 ])
591
+ assert com .is_extension_array_dtype (cat )
592
+ assert com .is_extension_array_dtype (pd .Series (cat ))
593
+ assert com .is_extension_array_dtype (pd .SparseArray ([1 , 2 , 3 ]))
594
+ assert com .is_extension_array_dtype (pd .DatetimeIndex (["2000" ], tz = "US/Eastern" ))
595
+
596
+ dtype = DatetimeTZDtype ("ns" , tz = "US/Eastern" )
597
+ s = pd .Series ([], dtype = dtype )
598
+ assert com .is_extension_array_dtype (s )
599
+
600
+ if check_scipy :
601
+ import scipy .sparse
602
+
603
+ assert not com .is_extension_array_dtype (scipy .sparse .bsr_matrix ([1 , 2 , 3 ]))
604
+
605
+
576
606
def test_is_complex_dtype ():
577
607
assert not com .is_complex_dtype (int )
578
608
assert not com .is_complex_dtype (str )
0 commit comments