File tree Expand file tree Collapse file tree 1 file changed +17
-7
lines changed Expand file tree Collapse file tree 1 file changed +17
-7
lines changed Original file line number Diff line number Diff line change 7575 FloatingArray ,
7676 IntegerArray ,
7777)
78+ from pandas .core .dtypes .dtypes import ExtensionDtype
7879
80+ from pandas .core
7981
8082@pytest .fixture (params = [True , False ], ids = str )
8183def coerce (request ):
8284 return request .param
8385
84- class MockScalar :
85- pass
86-
87- class MockDtype (pd .api .extensions .ExtensionDtype ):
88-
89-
90-
9186
9287class MockNumpyLikeArray :
9388 """
@@ -2032,3 +2027,18 @@ def test_find_result_type_int_int(right, result):
20322027def test_find_result_type_floats (right , result ):
20332028 left_dtype = np .dtype ("float16" )
20342029 assert find_result_type (left_dtype , right ) == result
2030+
2031+ def test_infer_dtype_extensiondtype ():
2032+ class MockScalar :
2033+ pass
2034+
2035+ class MockDtype (ExtensionDtype ):
2036+ @property
2037+ def name (self ):
2038+ return "MockDtype"
2039+ def is_unambiguous_scalar (scalar ):
2040+ if isinstance (scalar , MockScalar ):
2041+ return True
2042+ return False
2043+ arr = [MockScalar ()]
2044+ assert lib .infer_dtype (arr , skipna = True ) == "MockDtype"
You can’t perform that action at this time.
0 commit comments