https://github.com/python/cpython/commit/8665769614183263a4370b35a4fdbe852e651e17
commit: 8665769614183263a4370b35a4fdbe852e651e17
branch: main
author: ROHAN WINSOR <[email protected]>
committer: hauntsaninja <[email protected]>
date: 2025-08-14T21:26:02Z
summary:

gh-137716:  Fix double period in AttributeError message for invalid mock 
assertions (#137717)

files:
A 
Misc/NEWS.d/next/Core_and_Builtins/2025-08-13-16-58-58.gh-issue-137716.ZcZSyi.rst
M Lib/unittest/mock.py

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

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to