(self)
| 502 | self.assertEqual(list(weak_it), [4, 5, 6]) |
| 503 | |
| 504 | def test_proxy_bad_next(self): |
| 505 | # bpo-44720: PyIter_Next() shouldn't be called if the reference |
| 506 | # isn't an iterator. |
| 507 | |
| 508 | not_an_iterator = lambda: 0 |
| 509 | |
| 510 | class A: |
| 511 | def __iter__(self): |
| 512 | return weakref.proxy(not_an_iterator) |
| 513 | a = A() |
| 514 | |
| 515 | msg = "Weakref proxy referenced a non-iterator" |
| 516 | with self.assertRaisesRegex(TypeError, msg): |
| 517 | list(a) |
| 518 | |
| 519 | def test_proxy_reversed(self): |
| 520 | class MyObj: |
nothing calls this directly
no test coverage detected