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

Method test_yield_in_nested_try_excepts

Lib/test/test_exceptions.py:1784–1805  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1782 self.assertIn(b'MemoryError', err)
1783
1784 def test_yield_in_nested_try_excepts(self):
1785 #Issue #25612
1786 class MainError(Exception):
1787 pass
1788
1789 class SubError(Exception):
1790 pass
1791
1792 def main():
1793 try:
1794 raise MainError()
1795 except MainError:
1796 try:
1797 yield
1798 except SubError:
1799 pass
1800 raise
1801
1802 coro = main()
1803 coro.send(None)
1804 with self.assertRaises(MainError):
1805 coro.throw(SubError())
1806
1807 def test_generator_doesnt_retain_old_exc2(self):
1808 #Issue 28884#msg282532

Callers

nothing calls this directly

Calls 5

SubErrorClass · 0.85
mainFunction · 0.70
sendMethod · 0.45
assertRaisesMethod · 0.45
throwMethod · 0.45

Tested by

no test coverage detected