From e417e8b6beb65f0b741b8a58da584ef3a1514956 Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Wed, 29 Jan 2020 07:12:06 -0800 Subject: [PATCH] Backport PR #31411: COMPAT: dont pass dtype to datetime64 --- pandas/tests/scalar/timedelta/test_arithmetic.py | 2 +- pandas/tests/scalar/timestamp/test_timestamp.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pandas/tests/scalar/timedelta/test_arithmetic.py b/pandas/tests/scalar/timedelta/test_arithmetic.py index 3764d9b7548fc..6a9ef86c11292 100644 --- a/pandas/tests/scalar/timedelta/test_arithmetic.py +++ b/pandas/tests/scalar/timedelta/test_arithmetic.py @@ -498,7 +498,7 @@ def test_td_rfloordiv_invalid_scalar(self): # GH#18846 td = Timedelta(hours=3, minutes=3) - dt64 = np.datetime64("2016-01-01", dtype="datetime64[us]") + dt64 = np.datetime64("2016-01-01", "us") with pytest.raises(TypeError): td.__rfloordiv__(dt64) diff --git a/pandas/tests/scalar/timestamp/test_timestamp.py b/pandas/tests/scalar/timestamp/test_timestamp.py index 2f3175598d592..1ce1087ccca9d 100644 --- a/pandas/tests/scalar/timestamp/test_timestamp.py +++ b/pandas/tests/scalar/timestamp/test_timestamp.py @@ -575,7 +575,7 @@ def test_bounds_with_different_units(self): for date_string in out_of_bounds_dates: for unit in time_units: - dt64 = np.datetime64(date_string, dtype="M8[{unit}]".format(unit=unit)) + dt64 = np.datetime64(date_string, unit) with pytest.raises(ValueError): Timestamp(dt64) @@ -583,7 +583,7 @@ def test_bounds_with_different_units(self): for date_string in in_bounds_dates: for unit in time_units: - dt64 = np.datetime64(date_string, dtype="M8[{unit}]".format(unit=unit)) + dt64 = np.datetime64(date_string, unit) Timestamp(dt64) def test_min_valid(self):