Skip to content

Commit b727c6b

Browse files
alexcwattmroeschke
authored andcommitted
TST: Add regression test for #23986 (#25931)
* TST: Add regression test for #23986 * Update test name per convention
1 parent e01bcc3 commit b727c6b

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_raises(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)