@@ -549,6 +549,7 @@ def test_is_bool_dtype():
549549 assert com .is_bool_dtype (pd .Index ([True , False ]))
550550
551551
552+ @pytest .mark .filterwarnings ("ignore:'is_extension_type' is deprecated:FutureWarning" )
552553@pytest .mark .parametrize (
553554 "check_scipy" , [False , pytest .param (True , marks = td .skip_if_no_scipy )]
554555)
@@ -573,6 +574,35 @@ def test_is_extension_type(check_scipy):
573574 assert not com .is_extension_type (scipy .sparse .bsr_matrix ([1 , 2 , 3 ]))
574575
575576
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+
576606def test_is_complex_dtype ():
577607 assert not com .is_complex_dtype (int )
578608 assert not com .is_complex_dtype (str )
0 commit comments