(self)
| 404 | self.assertIs(p1, p2, "callbacks were None, NULL in the C API") |
| 405 | |
| 406 | def test_callable_proxy(self): |
| 407 | o = Callable() |
| 408 | ref1 = weakref.proxy(o) |
| 409 | |
| 410 | self.check_proxy(o, ref1) |
| 411 | |
| 412 | self.assertIs(type(ref1), weakref.CallableProxyType, |
| 413 | "proxy is not of callable type") |
| 414 | ref1('twinkies!') |
| 415 | self.assertEqual(o.bar, 'twinkies!', |
| 416 | "call through proxy not passed through to original") |
| 417 | ref1(x='Splat.') |
| 418 | self.assertEqual(o.bar, 'Splat.', |
| 419 | "call through proxy not passed through to original") |
| 420 | |
| 421 | # expect due to too few args |
| 422 | self.assertRaises(TypeError, ref1) |
| 423 | |
| 424 | # expect due to too many args |
| 425 | self.assertRaises(TypeError, ref1, 1, 2, 3) |
| 426 | |
| 427 | def check_proxy(self, o, proxy): |
| 428 | o.foo = 1 |
nothing calls this directly
no test coverage detected