Skip to content

Commit 1d58d2a

Browse files
committed
Add regression test for pandas-dev#23986
1 parent 882961d commit 1d58d2a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pandas/tests/indexes/datetimes/test_construction.py

+6
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,12 @@ def test_constructor_dtype(self):
535535
result = DatetimeIndex(idx, dtype='datetime64[ns, US/Eastern]')
536536
tm.assert_index_equal(idx, result)
537537

538+
@pytest.mark.parametrize('dtype', [object, np.int32, np.int64])
539+
def test_constructor_invalid_dtype(self, dtype):
540+
# GH 23986
541+
with pytest.raises(ValueError):
542+
DatetimeIndex([1, 2], dtype=dtype)
543+
538544
def test_constructor_name(self):
539545
idx = date_range(start='2000-01-01', periods=1, freq='A',
540546
name='TEST')

0 commit comments

Comments
 (0)