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 75
75
FloatingArray ,
76
76
IntegerArray ,
77
77
)
78
+ from pandas .core .dtypes .dtypes import ExtensionDtype
78
79
80
+ from pandas .core
79
81
80
82
@pytest .fixture (params = [True , False ], ids = str )
81
83
def coerce (request ):
82
84
return request .param
83
85
84
- class MockScalar :
85
- pass
86
-
87
- class MockDtype (pd .api .extensions .ExtensionDtype ):
88
-
89
-
90
-
91
86
92
87
class MockNumpyLikeArray :
93
88
"""
@@ -2032,3 +2027,18 @@ def test_find_result_type_int_int(right, result):
2032
2027
def test_find_result_type_floats (right , result ):
2033
2028
left_dtype = np .dtype ("float16" )
2034
2029
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