summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/test/testmock/testmagicmethods.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/unittest/test/testmock/testmagicmethods.py')
-rw-r--r--Lib/unittest/test/testmock/testmagicmethods.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/unittest/test/testmock/testmagicmethods.py b/Lib/unittest/test/testmock/testmagicmethods.py
index e05c6e0..bb9b956 100644
--- a/Lib/unittest/test/testmock/testmagicmethods.py
+++ b/Lib/unittest/test/testmock/testmagicmethods.py
@@ -424,6 +424,17 @@ class TestMockingMagicMethods(unittest.TestCase):
self.assertEqual(list(m), [])
+ def test_matmul(self):
+ m = MagicMock()
+ self.assertIsInstance(m @ 1, MagicMock)
+ m.__matmul__.return_value = 42
+ m.__rmatmul__.return_value = 666
+ m.__imatmul__.return_value = 24
+ self.assertEqual(m @ 1, 42)
+ self.assertEqual(1 @ m, 666)
+ m @= 24
+ self.assertEqual(m, 24)
+
def test_divmod_and_rdivmod(self):
m = MagicMock()
self.assertIsInstance(divmod(5, m), MagicMock)