diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py index e1dbfdacf56337..0bb6750655380d 100644 --- a/Lib/unittest/mock.py +++ b/Lib/unittest/mock.py @@ -700,7 +700,7 @@ def __getattr__(self, name): if name.startswith(('assert', 'assret', 'asert', 'aseert', 'assrt')) or name in _ATTRIB_DENY_LIST: raise AttributeError( f"{name!r} is not a valid assertion. Use a spec " - f"for the mock if {name!r} is meant to be an attribute.") + f"for the mock if {name!r} is meant to be an attribute") with NonCallableMock._lock: result = self._mock_children.get(name) diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2025-08-13-16-58-58.gh-issue-137716.ZcZSyi.rst b/Misc/NEWS.d/next/Core_and_Builtins/2025-08-13-16-58-58.gh-issue-137716.ZcZSyi.rst new file mode 100644 index 00000000000000..82d8e1577905a7 --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2025-08-13-16-58-58.gh-issue-137716.ZcZSyi.rst @@ -0,0 +1 @@ +Fix double period in :exc:`AttributeError` message for invalid mock assertions