Python collections.abc.AsyncIterator() Examples
The following are 4
code examples of collections.abc.AsyncIterator().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
collections.abc
, or try the search function
.
Example #1
Source File: test_collections.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def test_AsyncIterator(self): class AI: async def __aiter__(self): return self async def __anext__(self): raise StopAsyncIteration self.assertTrue(isinstance(AI(), AsyncIterator)) self.assertTrue(issubclass(AI, AsyncIterator)) non_samples = [None, object, []] # Check some non-iterables for x in non_samples: self.assertNotIsInstance(x, AsyncIterator) self.assertFalse(issubclass(type(x), AsyncIterator), repr(type(x))) # Similarly to regular iterators (see issue 10565) class AnextOnly: async def __anext__(self): raise StopAsyncIteration self.assertNotIsInstance(AnextOnly(), AsyncIterator) self.validate_abstract_methods(AsyncIterator, '__anext__', '__aiter__')
Example #2
Source File: test_collections.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 6 votes |
def test_AsyncIterator(self): class AI: async def __aiter__(self): return self async def __anext__(self): raise StopAsyncIteration self.assertTrue(isinstance(AI(), AsyncIterator)) self.assertTrue(issubclass(AI, AsyncIterator)) non_samples = [None, object, []] # Check some non-iterables for x in non_samples: self.assertNotIsInstance(x, AsyncIterator) self.assertFalse(issubclass(type(x), AsyncIterator), repr(type(x))) # Similarly to regular iterators (see issue 10565) class AnextOnly: async def __anext__(self): raise StopAsyncIteration self.assertNotIsInstance(AnextOnly(), AsyncIterator) self.validate_abstract_methods(AsyncIterator, '__anext__', '__aiter__')
Example #3
Source File: test_collections.py From android_universal with MIT License | 6 votes |
def test_AsyncIterator(self): class AI: def __aiter__(self): return self async def __anext__(self): raise StopAsyncIteration self.assertTrue(isinstance(AI(), AsyncIterator)) self.assertTrue(issubclass(AI, AsyncIterator)) non_samples = [None, object, []] # Check some non-iterables for x in non_samples: self.assertNotIsInstance(x, AsyncIterator) self.assertFalse(issubclass(type(x), AsyncIterator), repr(type(x))) # Similarly to regular iterators (see issue 10565) class AnextOnly: async def __anext__(self): raise StopAsyncIteration self.assertNotIsInstance(AnextOnly(), AsyncIterator) self.validate_abstract_methods(AsyncIterator, '__anext__', '__aiter__')
Example #4
Source File: time.py From async-worker with MIT License | 5 votes |
def __aiter__(self) -> AsyncIterator: if self._running is not None: raise RuntimeError("Cannot reuse a clock instance.") self._running = True self._main_task = asyncio.ensure_future(self._run()) return self