summaryrefslogtreecommitdiff
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_weakref.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py
index 50a46f817f..6f15c03ac5 100644
--- a/Lib/test/test_weakref.py
+++ b/Lib/test/test_weakref.py
@@ -285,6 +285,21 @@ class ReferencesTestCase(TestBase):
p //= 5
self.assertEqual(p, 21)
+ def test_proxy_matmul(self):
+ class C:
+ def __matmul__(self, other):
+ return 1729
+ def __rmatmul__(self, other):
+ return -163
+ def __imatmul__(self, other):
+ return 561
+ o = C()
+ p = weakref.proxy(o)
+ self.assertEqual(p @ 5, 1729)
+ self.assertEqual(5 @ p, -163)
+ p @= 5
+ self.assertEqual(p, 561)
+
# The PyWeakref_* C API is documented as allowing either NULL or
# None as the value for the callback, where either means "no
# callback". The "no callback" ref and proxy objects are supposed