diff options
Diffstat (limited to 'Lib/unittest/mock.py')
-rw-r--r-- | Lib/unittest/mock.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py index 4db1bac..d43ea9e 100644 --- a/Lib/unittest/mock.py +++ b/Lib/unittest/mock.py @@ -632,8 +632,9 @@ class NonCallableMock(Base): raise AttributeError(name) if not self._mock_unsafe: if name.startswith(('assert', 'assret', 'asert', 'aseert', 'assrt')): - raise AttributeError("Attributes cannot start with 'assert' " - "or its misspellings") + raise AttributeError( + f"{name} is not a valid assertion. Use a spec " + f"for the mock if {name} is meant to be an attribute.") result = self._mock_children.get(name) if result is _deleted: |