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

Method test_for_11

Lib/test/test_coroutines.py:1781–1799  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1779 self.assertEqual(CNT, 0)
1780
1781 def test_for_11(self):
1782 class F:
1783 def __aiter__(self):
1784 return self
1785 def __anext__(self):
1786 return self
1787 def __await__(self):
1788 1 / 0
1789
1790 async def main():
1791 async for _ in F():
1792 pass
1793
1794 with self.assertRaisesRegex(TypeError,
1795 'an invalid object from __anext__') as c:
1796 main().send(None)
1797
1798 err = c.exception
1799 self.assertIsInstance(err.__cause__, ZeroDivisionError)
1800
1801 def test_for_tuple(self):
1802 class Done(Exception): pass

Callers

nothing calls this directly

Calls 4

assertRaisesRegexMethod · 0.80
assertIsInstanceMethod · 0.80
mainFunction · 0.70
sendMethod · 0.45

Tested by

no test coverage detected