Skip to content

Commit 5878fab

Browse files
committed
test
1 parent c7cc800 commit 5878fab

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

pandas/tests/dtypes/test_inference.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,19 +75,14 @@
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)
8183
def coerce(request):
8284
return request.param
8385

84-
class MockScalar:
85-
pass
86-
87-
class MockDtype(pd.api.extensions.ExtensionDtype):
88-
89-
90-
9186

9287
class MockNumpyLikeArray:
9388
"""
@@ -2032,3 +2027,18 @@ def test_find_result_type_int_int(right, result):
20322027
def 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"

0 commit comments

Comments
 (0)