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

Method test_proxy_bad_next

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

Source from the content-addressed store, hash-verified

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:

Callers

nothing calls this directly

Calls 3

listClass · 0.85
assertRaisesRegexMethod · 0.80
AClass · 0.70

Tested by

no test coverage detected