summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/test/testmock/testmagicmethods.py
diff options
context:
space:
mode:
authorJohn Reese <john@noswap.com>2018-05-22 20:01:10 (GMT)
committerVictor Stinner <vstinner@redhat.com>2018-05-22 20:01:10 (GMT)
commit6c4fab0f4b95410a1a964a75dcdd953697eff089 (patch)
tree3c63f129157aca2bf0c4294f7870ce61696b0806 /Lib/unittest/test/testmock/testmagicmethods.py
parent4e29f566e8821c09d8274eadcdd355e8b1284b8b (diff)
downloadcpython-6c4fab0f4b95410a1a964a75dcdd953697eff089.zip
cpython-6c4fab0f4b95410a1a964a75dcdd953697eff089.tar.gz
cpython-6c4fab0f4b95410a1a964a75dcdd953697eff089.tar.bz2
bpo-33516: Add support for __round__ in MagicMock (GH-6880)
unittest.mock.MagicMock now supports the __round__() magic method.
Diffstat (limited to 'Lib/unittest/test/testmock/testmagicmethods.py')
-rw-r--r--Lib/unittest/test/testmock/testmagicmethods.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/unittest/test/testmock/testmagicmethods.py b/Lib/unittest/test/testmock/testmagicmethods.py
index 37623dc..5ab9597 100644
--- a/Lib/unittest/test/testmock/testmagicmethods.py
+++ b/Lib/unittest/test/testmock/testmagicmethods.py
@@ -1,3 +1,4 @@
+import math
import unittest
import sys
from unittest.mock import Mock, MagicMock, _magics
@@ -280,6 +281,10 @@ class TestMockingMagicMethods(unittest.TestCase):
self.assertEqual(hash(mock), object.__hash__(mock))
self.assertEqual(str(mock), object.__str__(mock))
self.assertTrue(bool(mock))
+ self.assertEqual(round(mock), mock.__round__())
+ self.assertEqual(math.trunc(mock), mock.__trunc__())
+ self.assertEqual(math.floor(mock), mock.__floor__())
+ self.assertEqual(math.ceil(mock), mock.__ceil__())
# in Python 3 oct and hex use __index__
# so these tests are for __index__ in py3k