MCPcopy Index your code
hub / github.com/python/cpython / test_nested_gen_except_loop

Method test_nested_gen_except_loop

Lib/test/test_generators.py:488–506  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

486 self.assertIsNone(sys.exception())
487
488 def test_nested_gen_except_loop(self):
489 def gen():
490 for i in range(100):
491 self.assertIsInstance(sys.exception(), TypeError)
492 yield "doing"
493
494 def outer():
495 try:
496 raise TypeError
497 except:
498 for x in gen():
499 yield x
500
501 try:
502 raise ValueError
503 except Exception:
504 for x in outer():
505 self.assertEqual(x, "doing")
506 self.assertEqual(sys.exception(), None)
507
508 def test_except_throw_exception_context(self):
509 def gen():

Callers

nothing calls this directly

Calls 3

outerFunction · 0.70
assertEqualMethod · 0.45
exceptionMethod · 0.45

Tested by

no test coverage detected