Skip to content

Commit 926ca1e

Browse files
committed
Fix a derp.
1 parent 442b8c1 commit 926ca1e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

pandas/tests/types/test_cast.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,10 @@ def test_numpy_dtypes(self):
231231

232232
def test_pandas_dtypes(self):
233233
with self.assertRaises(TypeError):
234-
self.assertEqual(_find_common_type([CategoricalDtype]),
234+
self.assertEqual(_find_common_type([CategoricalDtype()]),
235235
CategoricalDtype)
236-
self.assertEqual(_find_common_type([DatetimeTZDtype]),
236+
with self.assertRaises(TypeError):
237+
self.assertEqual(_find_common_type([DatetimeTZDtype()]),
237238
DatetimeTZDtype)
238239

239240
if __name__ == '__main__':

pandas/types/cast.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -867,8 +867,7 @@ def _possibly_cast_to_datetime(value, dtype, errors='raise'):
867867
def _find_common_type(types):
868868
"""Find a common data type among the given dtypes."""
869869
# TODO: enable using pandas-specific types
870-
if any(issubclass(t, ExtensionDtype) or isinstance(t, ExtensionDtype)
871-
for t in types):
870+
if any(isinstance(t, ExtensionDtype) for t in types):
872871
raise TypeError("Common type discovery is currently only "
873872
"supported for pure numpy dtypes.")
874873
return np.find_common_type(types, [])

0 commit comments

Comments
 (0)