Skip to content

Commit b9e15be

Browse files
[3.12] Link to the glossary for "magic methods" in MagicMock (GH-111292) (#114002)
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 27f7f37 commit b9e15be

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
@@ -1960,8 +1960,8 @@ Mocking Magic Methods
19601960
~~~~~~~~~~~~~~~~~~~~~
19611961

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

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

20612061
``MagicMock`` is a subclass of :class:`Mock` with default implementations
2062-
of most of the magic methods. You can use ``MagicMock`` without having to
2063-
configure the magic methods yourself.
2062+
of most of the :term:`magic methods <magic method>`. You can use
2063+
``MagicMock`` without having to configure the magic methods yourself.
20642064

20652065
The constructor parameters have the same meaning as for :class:`Mock`.
20662066

0 commit comments

Comments
 (0)