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

Method test_AsyncIterator

Lib/test/test_collections.py:948–966  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

946 self.validate_isinstance(AsyncIterable, '__aiter__')
947
948 def test_AsyncIterator(self):
949 class AI:
950 def __aiter__(self):
951 return self
952 async def __anext__(self):
953 raise StopAsyncIteration
954 self.assertIsInstance(AI(), AsyncIterator)
955 self.assertIsSubclass(AI, AsyncIterator)
956 non_samples = [None, object, []]
957 # Check some non-iterables
958 for x in non_samples:
959 self.assertNotIsInstance(x, AsyncIterator)
960 self.assertNotIsSubclass(type(x), AsyncIterator)
961 # Similarly to regular iterators (see issue 10565)
962 class AnextOnly:
963 async def __anext__(self):
964 raise StopAsyncIteration
965 self.assertNotIsInstance(AnextOnly(), AsyncIterator)
966 self.validate_abstract_methods(AsyncIterator, '__anext__')
967
968 def test_Iterable(self):
969 # Check some non-iterables

Callers

nothing calls this directly

Calls 7

AnextOnlyClass · 0.85
assertIsInstanceMethod · 0.80
assertNotIsInstanceMethod · 0.80
AIClass · 0.70
assertIsSubclassMethod · 0.45
assertNotIsSubclassMethod · 0.45

Tested by

no test coverage detected