]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Capitalize first word in `unittest.mock.assert_*` docs and docstrings (#151951)
authorHans Yu <github@shauny.anonaddy.me>
Wed, 24 Jun 2026 10:07:21 +0000 (12:07 +0200)
committerGitHub <noreply@github.com>
Wed, 24 Jun 2026 10:07:21 +0000 (11:07 +0100)
Doc/library/unittest.mock.rst
Lib/unittest/mock.py

index 5e28a8ada595ef164b46583502cce35cd1035e6b..cce8f2833ac5a02db1f19c676b573d98bdf514b5 100644 (file)
@@ -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
index 14a490c165758570daf581c367612be4ced900c7..49011faaa51eaed2b5cb8bd4f125fd77ca14680d 100644 (file)
@@ -935,7 +935,7 @@ class NonCallableMock(Base):
             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 @@ class NonCallableMock(Base):
             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 @@ class NonCallableMock(Base):
             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 @@ class NonCallableMock(Base):
             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 @@ class NonCallableMock(Base):
 
 
     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 @@ class NonCallableMock(Base):
 
 
     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 @@ class NonCallableMock(Base):
 
 
     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