Skip to content

Commit c62e6c0

Browse files
Backport PR pandas-dev#31411: COMPAT: dont pass dtype to datetime64 (pandas-dev#31421)
Co-authored-by: jbrockmendel <[email protected]>
1 parent d633915 commit c62e6c0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

pandas/tests/scalar/timedelta/test_arithmetic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ def test_td_rfloordiv_invalid_scalar(self):
498498
# GH#18846
499499
td = Timedelta(hours=3, minutes=3)
500500

501-
dt64 = np.datetime64("2016-01-01", dtype="datetime64[us]")
501+
dt64 = np.datetime64("2016-01-01", "us")
502502
with pytest.raises(TypeError):
503503
td.__rfloordiv__(dt64)
504504

pandas/tests/scalar/timestamp/test_timestamp.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -575,15 +575,15 @@ def test_bounds_with_different_units(self):
575575

576576
for date_string in out_of_bounds_dates:
577577
for unit in time_units:
578-
dt64 = np.datetime64(date_string, dtype="M8[{unit}]".format(unit=unit))
578+
dt64 = np.datetime64(date_string, unit)
579579
with pytest.raises(ValueError):
580580
Timestamp(dt64)
581581

582582
in_bounds_dates = ("1677-09-23", "2262-04-11")
583583

584584
for date_string in in_bounds_dates:
585585
for unit in time_units:
586-
dt64 = np.datetime64(date_string, dtype="M8[{unit}]".format(unit=unit))
586+
dt64 = np.datetime64(date_string, unit)
587587
Timestamp(dt64)
588588

589589
def test_min_valid(self):

0 commit comments

Comments
 (0)