diff --git a/pandas/tests/test_flags.py b/pandas/tests/test_flags.py index f6e3ae4980afb..9294b3fc3319b 100644 --- a/pandas/tests/test_flags.py +++ b/pandas/tests/test_flags.py @@ -41,8 +41,8 @@ def test_getitem(self): flags["allows_duplicate_labels"] = False assert flags["allows_duplicate_labels"] is False - with pytest.raises(KeyError): + with pytest.raises(KeyError, match="a"): flags["a"] - with pytest.raises(ValueError): + with pytest.raises(ValueError, match="a"): flags["a"] = 10