@@ -86,7 +86,7 @@ def _construct(self, shape, value=None, dtype=None, **kwargs):
86
86
arr = np .repeat (arr ,new_shape ).reshape (shape )
87
87
else :
88
88
arr = np .random .randn (* shape )
89
- return self ._typ (arr ,** kwargs )
89
+ return self ._typ (arr ,dtype = dtype , ** kwargs )
90
90
91
91
def _compare (self , result , expected ):
92
92
self ._comparator (result ,expected )
@@ -210,6 +210,20 @@ def test_downcast(self):
210
210
expected = o .astype (np .int64 )
211
211
self ._compare (result , expected )
212
212
213
+ def test_constructor_compound_dtypes (self ):
214
+ # GH 5191
215
+ # compound dtypes should raise not-implementederror
216
+
217
+ def f (dtype ):
218
+ return self ._construct (shape = 3 , dtype = dtype )
219
+
220
+ self .assertRaises (NotImplementedError , f , [("A" ,"datetime64[h]" ), ("B" ,"str" ), ("C" ,"int32" )])
221
+
222
+ # these work (though results may be unexpected)
223
+ f ('int64' )
224
+ f ('float64' )
225
+ f ('M8[ns]' )
226
+
213
227
class TestSeries (unittest .TestCase , Generic ):
214
228
_typ = Series
215
229
_comparator = lambda self , x , y : assert_series_equal (x ,y )
0 commit comments