summaryrefslogtreecommitdiff
path: root/tests/functional/iterable_context_py36.py
diff options
context:
space:
mode:
authorAshley Whetter <ashley@awhetter.co.uk>2019-06-14 22:28:42 -0700
committerClaudiu Popa <pcmanticore@gmail.com>2019-06-20 10:02:14 +0200
commit33b8185a455c1686d038258697bb93005f2441c2 (patch)
tree4a50ccac775c009436e45803129e428ed694065f /tests/functional/iterable_context_py36.py
parent7081d91f30728653000bdfc59ea85a3395f96418 (diff)
downloadpylint-git-33b8185a455c1686d038258697bb93005f2441c2.tar.gz
Stopped installing tests with package
Diffstat (limited to 'tests/functional/iterable_context_py36.py')
-rw-r--r--tests/functional/iterable_context_py36.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/functional/iterable_context_py36.py b/tests/functional/iterable_context_py36.py
new file mode 100644
index 000000000..cc2e8e7df
--- /dev/null
+++ b/tests/functional/iterable_context_py36.py
@@ -0,0 +1,41 @@
+# pylint: disable=missing-docstring,too-few-public-methods,unused-variable
+import asyncio
+
+class AIter:
+ async def __aiter__(self):
+ for value in range(20):
+ yield value
+
+ async def to_list(self):
+ values = [m async for m in self]
+ other_values = [m for m in self] # [not-an-iterable]
+ for value in self: # [not-an-iterable]
+ yield value
+ async for value in self:
+ yield value
+
+
+async def some_iter_func(number):
+ """ emits 1 number per second """
+ for i in range(1, number):
+ yield i
+ await asyncio.sleep(1)
+
+
+async def count_to(number):
+ """ counts to n in async manner"""
+ async for i in some_iter_func(number):
+ print(i)
+
+
+async def gen_values(num_values):
+ for value in range(num_values):
+ yield value
+
+
+async def do_some_comprehensions():
+ sets = {elem async for elem in gen_values(10)}
+ lists = [elem async for elem in gen_values(10)]
+ dicts = {elem: elem async for elem in gen_values(10)}
+ gen = (elem async for elem in gen_values(10))
+ return sets, lists, dicts, gen