MCPcopy Create free account
hub / github.com/RustPython/RustPython / test_for_11

Method test_for_11

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

Source from the content-addressed store, hash-verified

1791
1792 @unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: "an invalid object from __anext__" does not match "'F' object is not an iterator"
1793 def test_for_11(self):
1794 class F:
1795 def __aiter__(self):
1796 return self
1797 def __anext__(self):
1798 return self
1799 def __await__(self):
1800 1 / 0
1801
1802 async def main():
1803 async for _ in F():
1804 pass
1805
1806 with self.assertRaisesRegex(TypeError,
1807 'an invalid object from __anext__') as c:
1808 main().send(None)
1809
1810 err = c.exception
1811 self.assertIsInstance(err.__cause__, ZeroDivisionError)
1812
1813 def test_for_tuple(self):
1814 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