Skip to content

Commit dcbcf09

Browse files
[3.15] Capitalize first word in unittest.mock.assert_* docs and docstrings (pythonGH-151951) (python#152059)
(cherry picked from commit a46db4f) Co-authored-by: Hans Yu <github@shauny.anonaddy.me>
1 parent 0adb386 commit dcbcf09

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

Doc/library/unittest.mock.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ the *new_callable* argument to :func:`patch`.
345345

346346
.. method:: assert_any_call(*args, **kwargs)
347347

348-
assert the mock has been called with the specified arguments.
348+
Assert the mock has been called with the specified arguments.
349349

350350
The assert passes if the mock has *ever* been called, unlike
351351
:meth:`assert_called_with` and :meth:`assert_called_once_with` that
@@ -360,7 +360,7 @@ the *new_callable* argument to :func:`patch`.
360360

361361
.. method:: assert_has_calls(calls, any_order=False)
362362

363-
assert the mock has been called with the specified calls.
363+
Assert the mock has been called with the specified calls.
364364
The :attr:`mock_calls` list is checked for the calls.
365365

366366
If *any_order* is false then the calls must be

Lib/unittest/mock.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ def _call_matcher(self, _call):
937937
return _call
938938

939939
def assert_not_called(self):
940-
"""assert that the mock was never called.
940+
"""Assert that the mock was never called.
941941
"""
942942
if self.call_count != 0:
943943
msg = ("Expected '%s' to not have been called. Called %s times.%s"
@@ -947,15 +947,15 @@ def assert_not_called(self):
947947
raise AssertionError(msg)
948948

949949
def assert_called(self):
950-
"""assert that the mock was called at least once
950+
"""Assert that the mock was called at least once.
951951
"""
952952
if self.call_count == 0:
953953
msg = ("Expected '%s' to have been called." %
954954
(self._mock_name or 'mock'))
955955
raise AssertionError(msg)
956956

957957
def assert_called_once(self):
958-
"""assert that the mock was called only once.
958+
"""Assert that the mock was called only once.
959959
"""
960960
if not self.call_count == 1:
961961
msg = ("Expected '%s' to have been called once. Called %s times.%s"
@@ -965,7 +965,7 @@ def assert_called_once(self):
965965
raise AssertionError(msg)
966966

967967
def assert_called_with(self, /, *args, **kwargs):
968-
"""assert that the last call was made with the specified arguments.
968+
"""Assert that the last call was made with the specified arguments.
969969
970970
Raises an AssertionError if the args and keyword args passed in are
971971
different to the last call to the mock."""
@@ -987,7 +987,7 @@ def _error_message():
987987

988988

989989
def assert_called_once_with(self, /, *args, **kwargs):
990-
"""assert that the mock was called exactly once and that call was
990+
"""Assert that the mock was called exactly once and that call was
991991
with the specified arguments."""
992992
if not self.call_count == 1:
993993
msg = ("Expected '%s' to be called once. Called %s times.%s"
@@ -999,7 +999,7 @@ def assert_called_once_with(self, /, *args, **kwargs):
999999

10001000

10011001
def assert_has_calls(self, calls, any_order=False):
1002-
"""assert the mock has been called with the specified calls.
1002+
"""Assert the mock has been called with the specified calls.
10031003
The `mock_calls` list is checked for the calls.
10041004
10051005
If `any_order` is False (the default) then the calls must be
@@ -1044,7 +1044,7 @@ def assert_has_calls(self, calls, any_order=False):
10441044

10451045

10461046
def assert_any_call(self, /, *args, **kwargs):
1047-
"""assert the mock has been called with the specified arguments.
1047+
"""Assert the mock has been called with the specified arguments.
10481048
10491049
The assert passes if the mock has *ever* been called, unlike
10501050
`assert_called_with` and `assert_called_once_with` that only pass if

0 commit comments

Comments
 (0)