diff --git a/pandas/tests/io/test_stata.py b/pandas/tests/io/test_stata.py index edb766a67af89..a5a7333f4b232 100644 --- a/pandas/tests/io/test_stata.py +++ b/pandas/tests/io/test_stata.py @@ -1374,7 +1374,7 @@ def test_unsupported_datetype(self): "dates": dates, } ) - with pytest.raises(NotImplementedError): + with pytest.raises(NotImplementedError, match=msg): with tm.ensure_clean() as path: original.to_stata(path) diff --git a/pandas/tests/plotting/test_frame.py b/pandas/tests/plotting/test_frame.py index 1c429bafa9a19..fe7941d21de4e 100644 --- a/pandas/tests/plotting/test_frame.py +++ b/pandas/tests/plotting/test_frame.py @@ -2413,7 +2413,7 @@ def test_partially_invalid_plot_data(self): df = DataFrame(rand(10, 2), dtype=object) df[np.random.rand(df.shape[0]) > 0.5] = "a" for kind in kinds: - with pytest.raises(TypeError): + with pytest.raises(TypeError, match=msg): df.plot(kind=kind) def test_invalid_kind(self):