Skip to content

Commit f9cd40f

Browse files
bpo-45010: Remove support of special method __div__ in unittest.mock (GH-27965)
1 parent 989f6a3 commit f9cd40f

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

Doc/library/unittest.mock.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2020,7 +2020,7 @@ The full list of supported magic methods is:
20202020
* Context manager: ``__enter__``, ``__exit__``, ``__aenter__`` and ``__aexit__``
20212021
* Unary numeric methods: ``__neg__``, ``__pos__`` and ``__invert__``
20222022
* The numeric methods (including right hand and in-place variants):
2023-
``__add__``, ``__sub__``, ``__mul__``, ``__matmul__``, ``__div__``, ``__truediv__``,
2023+
``__add__``, ``__sub__``, ``__mul__``, ``__matmul__``, ``__truediv__``,
20242024
``__floordiv__``, ``__mod__``, ``__divmod__``, ``__lshift__``,
20252025
``__rshift__``, ``__and__``, ``__xor__``, ``__or__``, and ``__pow__``
20262026
* Numeric conversion methods: ``__complex__``, ``__int__``, ``__float__``

Lib/unittest/mock.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1929,7 +1929,7 @@ def _patch_stopall():
19291929
)
19301930

19311931
numerics = (
1932-
"add sub mul matmul div floordiv mod lshift rshift and xor or pow truediv"
1932+
"add sub mul matmul truediv floordiv mod lshift rshift and xor or pow"
19331933
)
19341934
inplace = ' '.join('i%s' % n for n in numerics.split())
19351935
right = ' '.join('r%s' % n for n in numerics.split())
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Remove support of special method ``__div__`` in :mod:`unittest.mock`. It is
2+
not used in Python 3.

0 commit comments

Comments
 (0)