diff --git a/pandas/tests/series/test_constructors.py b/pandas/tests/series/test_constructors.py index 36a581a8ca492..22076eb05db88 100644 --- a/pandas/tests/series/test_constructors.py +++ b/pandas/tests/series/test_constructors.py @@ -1390,10 +1390,14 @@ def test_constructor_cast_object(self, index): tm.assert_series_equal(s, exp) @pytest.mark.parametrize("dtype", [np.datetime64, np.timedelta64]) - def test_constructor_generic_timestamp_no_frequency(self, dtype): + def test_constructor_generic_timestamp_no_frequency(self, dtype, request): # see gh-15524, gh-15987 msg = "dtype has no unit. Please pass in" + if np.dtype(dtype).name not in ["timedelta64", "datetime64"]: + mark = pytest.mark.xfail(reason="GH#33890 Is assigned ns unit") + request.node.add_marker(mark) + with pytest.raises(ValueError, match=msg): Series([], dtype=dtype) diff --git a/pandas/tests/series/test_dtypes.py b/pandas/tests/series/test_dtypes.py index 05e708e575a64..bcc0b18134dad 100644 --- a/pandas/tests/series/test_dtypes.py +++ b/pandas/tests/series/test_dtypes.py @@ -382,11 +382,15 @@ def test_astype_categoricaldtype(self): tm.assert_index_equal(result.cat.categories, Index(["a", "b", "c"])) @pytest.mark.parametrize("dtype", [np.datetime64, np.timedelta64]) - def test_astype_generic_timestamp_no_frequency(self, dtype): + def test_astype_generic_timestamp_no_frequency(self, dtype, request): # see gh-15524, gh-15987 data = [1] s = Series(data) + if np.dtype(dtype).name not in ["timedelta64", "datetime64"]: + mark = pytest.mark.xfail(reason="GH#33890 Is assigned ns unit") + request.node.add_marker(mark) + msg = ( fr"The '{dtype.__name__}' dtype has no unit\. " fr"Please pass in '{dtype.__name__}\[ns\]' instead."