Skip to content

Commit 2d184b2

Browse files
[3.11] Link to the glossary for "magic methods" in MagicMock (GH-111292) (#114003)
Link to the glossary for "magic methods" in ``MagicMock`` (GH-111292) The MagicMock documentation mentions magic methods several times without actually pointing to the term in the glossary. This can be helpful for people to fully understand what those magic methods are. (cherry picked from commit e97da86) Co-authored-by: Pierre Equoy <[email protected]>
1 parent 4bd4367 commit 2d184b2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Doc/library/unittest.mock.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1958,8 +1958,8 @@ Mocking Magic Methods
19581958
~~~~~~~~~~~~~~~~~~~~~
19591959

19601960
:class:`Mock` supports mocking the Python protocol methods, also known as
1961-
"magic methods". This allows mock objects to replace containers or other
1962-
objects that implement Python protocols.
1961+
:term:`"magic methods" <magic method>`. This allows mock objects to replace
1962+
containers or other objects that implement Python protocols.
19631963

19641964
Because magic methods are looked up differently from normal methods [#]_, this
19651965
support has been specially implemented. This means that only specific magic
@@ -2057,8 +2057,8 @@ There are two ``MagicMock`` variants: :class:`MagicMock` and :class:`NonCallable
20572057
.. class:: MagicMock(*args, **kw)
20582058

20592059
``MagicMock`` is a subclass of :class:`Mock` with default implementations
2060-
of most of the magic methods. You can use ``MagicMock`` without having to
2061-
configure the magic methods yourself.
2060+
of most of the :term:`magic methods <magic method>`. You can use
2061+
``MagicMock`` without having to configure the magic methods yourself.
20622062

20632063
The constructor parameters have the same meaning as for :class:`Mock`.
20642064

0 commit comments

Comments
 (0)