@@ -106,6 +106,48 @@ def test_period_dtype(self, dtype):
106
106
assert com .pandas_dtype (dtype ) == PeriodDtype (dtype )
107
107
assert com .pandas_dtype (dtype ) == dtype
108
108
109
+ @pytest .mark .parametrize (
110
+ "cls" ,
111
+ (
112
+ pd .BooleanDtype ,
113
+ pd .Int8Dtype ,
114
+ pd .Int16Dtype ,
115
+ pd .Int32Dtype ,
116
+ pd .Int64Dtype ,
117
+ pd .UInt8Dtype ,
118
+ pd .UInt16Dtype ,
119
+ pd .UInt32Dtype ,
120
+ pd .UInt64Dtype ,
121
+ pd .Float32Dtype ,
122
+ pd .Float64Dtype ,
123
+ pd .SparseDtype ,
124
+ pd .StringDtype ,
125
+ IntervalDtype ,
126
+ CategoricalDtype ,
127
+ pytest .param (
128
+ DatetimeTZDtype ,
129
+ marks = pytest .mark .xfail (reason = "must specify TZ" , raises = TypeError ),
130
+ ),
131
+ pytest .param (
132
+ PeriodDtype ,
133
+ marks = pytest .mark .xfail (
134
+ reason = "must specify frequency" , raises = AttributeError
135
+ ),
136
+ ),
137
+ ),
138
+ )
139
+ def test_pd_extension_dtype (self , cls ):
140
+ """
141
+ TODO: desired behavior?
142
+
143
+ For extension dtypes that admit no options OR can be initialized with no args
144
+ passed, convert the extension dtype class to an instance of that class.
145
+ """
146
+ expected = cls ()
147
+ result = com .pandas_dtype (cls )
148
+
149
+ assert result == expected
150
+
109
151
110
152
dtypes = {
111
153
"datetime_tz" : com .pandas_dtype ("datetime64[ns, US/Eastern]" ),
@@ -689,6 +731,8 @@ def test_is_complex_dtype():
689
731
(PeriodDtype (freq = "D" ), PeriodDtype (freq = "D" )),
690
732
("period[D]" , PeriodDtype (freq = "D" )),
691
733
(IntervalDtype (), IntervalDtype ()),
734
+ (pd .BooleanDtype , pd .BooleanDtype ()),
735
+ (pd .BooleanDtype (), pd .BooleanDtype ()),
692
736
],
693
737
)
694
738
def test_get_dtype (input_param , result ):
0 commit comments