diff --git a/pandas/tests/scalar/timedelta/test_arithmetic.py b/pandas/tests/scalar/timedelta/test_arithmetic.py index ce08a47f824ee..5fc991df49424 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 e9c0ee12fc000..692eb6cd8bc43 100644 --- a/pandas/tests/scalar/timestamp/test_timestamp.py +++ b/pandas/tests/scalar/timestamp/test_timestamp.py @@ -565,7 +565,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) @@ -573,7 +573,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):