Skip to content

Commit d136227

Browse files
committed
Moved dtypes
1 parent 87583dc commit d136227

File tree

2 files changed

+30
-31
lines changed

2 files changed

+30
-31
lines changed

pandas/tests/dtypes/test_dtypes.py

+1-31
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,12 @@
1010
Series, Categorical, CategoricalIndex, IntervalIndex, date_range)
1111

1212
from pandas.compat import string_types
13-
from pandas.core.arrays import ExtensionArray
1413
from pandas.core.dtypes.dtypes import (
1514
DatetimeTZDtype, PeriodDtype,
16-
IntervalDtype, CategoricalDtype, ExtensionDtype)
15+
IntervalDtype, CategoricalDtype)
1716
from pandas.core.dtypes.common import (
1817
is_categorical_dtype, is_categorical,
1918
is_datetime64tz_dtype, is_datetimetz,
20-
is_extension_array_dtype,
2119
is_period_dtype, is_period,
2220
is_dtype_equal, is_datetime64_ns_dtype,
2321
is_datetime64_dtype, is_interval_dtype,
@@ -744,31 +742,3 @@ def test_categorical_categories(self):
744742
tm.assert_index_equal(c1.categories, pd.Index(['a', 'b']))
745743
c1 = CategoricalDtype(CategoricalIndex(['a', 'b']))
746744
tm.assert_index_equal(c1.categories, pd.Index(['a', 'b']))
747-
748-
749-
class DummyArray(ExtensionArray):
750-
pass
751-
752-
753-
class DummyDtype(ExtensionDtype):
754-
pass
755-
756-
757-
class TestExtensionArrayDtype(object):
758-
759-
@pytest.mark.parametrize('values', [
760-
pd.Categorical([]),
761-
pd.Categorical([]).dtype,
762-
pd.Series(pd.Categorical([])),
763-
DummyDtype(),
764-
DummyArray(),
765-
])
766-
def test_is_extension_array_dtype(self, values):
767-
assert is_extension_array_dtype(values)
768-
769-
@pytest.mark.parametrize('values', [
770-
np.array([]),
771-
pd.Series(np.array([])),
772-
])
773-
def test_is_not_extension_array_dtype(self, values):
774-
assert not is_extension_array_dtype(values)

pandas/tests/extension/test_common.py

+29
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
import numpy as np
2+
import pytest
23

4+
import pandas as pd
35
import pandas.util.testing as tm
46
from pandas.core.arrays import ExtensionArray
7+
from pandas.core.dtypes.common import is_extension_array_dtype
8+
from pandas.core.dtypes.dtypes import ExtensionDtype
9+
10+
11+
class DummyDtype(ExtensionDtype):
12+
pass
513

614

715
class DummyArray(ExtensionArray):
@@ -17,7 +25,28 @@ def dtype(self):
1725
return self.data.dtype
1826

1927

28+
class TestExtensionArrayDtype(object):
29+
30+
@pytest.mark.parametrize('values', [
31+
pd.Categorical([]),
32+
pd.Categorical([]).dtype,
33+
pd.Series(pd.Categorical([])),
34+
DummyDtype(),
35+
DummyArray(np.array([1, 2])),
36+
])
37+
def test_is_extension_array_dtype(self, values):
38+
assert is_extension_array_dtype(values)
39+
40+
@pytest.mark.parametrize('values', [
41+
np.array([]),
42+
pd.Series(np.array([])),
43+
])
44+
def test_is_not_extension_array_dtype(self, values):
45+
assert not is_extension_array_dtype(values)
46+
47+
2048
def test_astype():
49+
2150
arr = DummyArray(np.array([1, 2, 3]))
2251
expected = np.array([1, 2, 3], dtype=object)
2352

0 commit comments

Comments
 (0)