diff --git a/pandas/tests/indexes/datetimes/test_ops.py b/pandas/tests/indexes/datetimes/test_ops.py index cd8d5bd7b260b..fb032947143d3 100644 --- a/pandas/tests/indexes/datetimes/test_ops.py +++ b/pandas/tests/indexes/datetimes/test_ops.py @@ -41,9 +41,9 @@ def test_ops_properties_basic(self): # sanity check that the behavior didn't change # GH#7206 - msg = "'Series' object has no attribute '{}'" for op in ["year", "day", "second", "weekday"]: - with pytest.raises(AttributeError, match=msg.format(op)): + msg = f"'Series' object has no attribute '{op}'" + with pytest.raises(AttributeError, match=msg): getattr(self.dt_series, op) # attribute access should still work!