https://github.com/python/cpython/commit/a46db4f8ba4aa84e0fc5b6986c2388cae2e873ae
commit: a46db4f8ba4aa84e0fc5b6986c2388cae2e873ae
branch: main
author: Hans Yu <[email protected]>
committer: StanFromIreland <[email protected]>
date: 2026-06-24T11:07:21+01:00
summary:

Capitalize first word in `unittest.mock.assert_*` docs and docstrings (#151951)

files:
M Doc/library/unittest.mock.rst
M Lib/unittest/mock.py

diff --git a/Doc/library/unittest.mock.rst b/Doc/library/unittest.mock.rst
index 5e28a8ada595ef1..cce8f2833ac5a02 100644
--- a/Doc/library/unittest.mock.rst
+++ b/Doc/library/unittest.mock.rst
@@ -345,7 +345,7 @@ the *new_callable* argument to :func:`patch`.
 
     .. method:: assert_any_call(*args, **kwargs)
 
-        assert the mock has been called with the specified arguments.
+        Assert the mock has been called with the specified arguments.
 
         The assert passes if the mock has *ever* been called, unlike
         :meth:`assert_called_with` and :meth:`assert_called_once_with` that
@@ -360,7 +360,7 @@ the *new_callable* argument to :func:`patch`.
 
     .. method:: assert_has_calls(calls, any_order=False)
 
-        assert the mock has been called with the specified calls.
+        Assert the mock has been called with the specified calls.
         The :attr:`mock_calls` list is checked for the calls.
 
         If *any_order* is false then the calls must be
diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py
index 14a490c16575857..49011faaa51eaed 100644
--- a/Lib/unittest/mock.py
+++ b/Lib/unittest/mock.py
@@ -935,7 +935,7 @@ def _call_matcher(self, _call):
             return _call
 
     def assert_not_called(self):
-        """assert that the mock was never called.
+        """Assert that the mock was never called.
         """
         if self.call_count != 0:
             msg = ("Expected '%s' to not have been called. Called %s times.%s"
@@ -945,7 +945,7 @@ def assert_not_called(self):
             raise AssertionError(msg)
 
     def assert_called(self):
-        """assert that the mock was called at least once
+        """Assert that the mock was called at least once.
         """
         if self.call_count == 0:
             msg = ("Expected '%s' to have been called." %
@@ -953,7 +953,7 @@ def assert_called(self):
             raise AssertionError(msg)
 
     def assert_called_once(self):
-        """assert that the mock was called only once.
+        """Assert that the mock was called only once.
         """
         if not self.call_count == 1:
             msg = ("Expected '%s' to have been called once. Called %s times.%s"
@@ -963,7 +963,7 @@ def assert_called_once(self):
             raise AssertionError(msg)
 
     def assert_called_with(self, /, *args, **kwargs):
-        """assert that the last call was made with the specified arguments.
+        """Assert that the last call was made with the specified arguments.
 
         Raises an AssertionError if the args and keyword args passed in are
         different to the last call to the mock."""
@@ -985,7 +985,7 @@ def _error_message():
 
 
     def assert_called_once_with(self, /, *args, **kwargs):
-        """assert that the mock was called exactly once and that call was
+        """Assert that the mock was called exactly once and that call was
         with the specified arguments."""
         if not self.call_count == 1:
             msg = ("Expected '%s' to be called once. Called %s times.%s"
@@ -997,7 +997,7 @@ def assert_called_once_with(self, /, *args, **kwargs):
 
 
     def assert_has_calls(self, calls, any_order=False):
-        """assert the mock has been called with the specified calls.
+        """Assert the mock has been called with the specified calls.
         The `mock_calls` list is checked for the calls.
 
         If `any_order` is False (the default) then the calls must be
@@ -1042,7 +1042,7 @@ def assert_has_calls(self, calls, any_order=False):
 
 
     def assert_any_call(self, /, *args, **kwargs):
-        """assert the mock has been called with the specified arguments.
+        """Assert the mock has been called with the specified arguments.
 
         The assert passes if the mock has *ever* been called, unlike
         `assert_called_with` and `assert_called_once_with` that only pass if

_______________________________________________
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