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

Method test_callable_proxy

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

Source from the content-addressed store, hash-verified

408
409 @unittest.expectedFailure # TODO: RUSTPYTHON
410 def test_callable_proxy(self):
411 o = Callable()
412 ref1 = weakref.proxy(o)
413
414 self.check_proxy(o, ref1)
415
416 self.assertIs(type(ref1), weakref.CallableProxyType,
417 "proxy is not of callable type")
418 ref1('twinkies!')
419 self.assertEqual(o.bar, 'twinkies!',
420 "call through proxy not passed through to original")
421 ref1(x='Splat.')
422 self.assertEqual(o.bar, 'Splat.',
423 "call through proxy not passed through to original")
424
425 # expect due to too few args
426 self.assertRaises(TypeError, ref1)
427
428 # expect due to too many args
429 self.assertRaises(TypeError, ref1, 1, 2, 3)
430
431 def check_proxy(self, o, proxy):
432 o.foo = 1

Callers

nothing calls this directly

Calls 6

check_proxyMethod · 0.95
proxyMethod · 0.80
CallableClass · 0.70
assertIsMethod · 0.45
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected