MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_proxy_matmul

Method test_proxy_matmul

Lib/test/test_weakref.py:360–373  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

358 self.assertEqual(p, 21)
359
360 def test_proxy_matmul(self):
361 class C:
362 def __matmul__(self, other):
363 return 1729
364 def __rmatmul__(self, other):
365 return -163
366 def __imatmul__(self, other):
367 return 561
368 o = C()
369 p = weakref.proxy(o)
370 self.assertEqual(p @ 5, 1729)
371 self.assertEqual(5 @ p, -163)
372 p @= 5
373 self.assertEqual(p, 561)
374
375 # The PyWeakref_* C API is documented as allowing either NULL or
376 # None as the value for the callback, where either means "no

Callers

nothing calls this directly

Calls 3

proxyMethod · 0.80
CClass · 0.70
assertEqualMethod · 0.45

Tested by

no test coverage detected