summaryrefslogtreecommitdiff
path: root/tests/functional/i/iterable_context_py3.py
blob: 34047eda0dfc971f7544a165ffd99470547c1789 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
"""
Checks that iterable metaclasses are recognized by pylint.
"""
# pylint: disable=missing-docstring,too-few-public-methods,no-init,no-self-use,unused-argument,bad-mcs-method-argument
# pylint: disable=wrong-import-position
# metaclasses as iterables
class Meta(type):
    def __iter__(self):
        return iter((1, 2, 3))

class SomeClass(metaclass=Meta):
    pass


for i in SomeClass:
    print(i)
for i in SomeClass():  # [not-an-iterable]
    print(i)


import asyncio


@asyncio.coroutine
def coroutine_function_return_none():
    return


@asyncio.coroutine
def coroutine_function_return_object():
    return 12


@asyncio.coroutine
def coroutine_function_return_future():
    return asyncio.Future()


@asyncio.coroutine
def coroutine_function_pass():
    pass


@asyncio.coroutine
def coroutine_generator():
    yield


@asyncio.coroutine
def main():
    yield from coroutine_function_return_none()
    yield from coroutine_function_return_object()
    yield from coroutine_function_return_future()
    yield from coroutine_function_pass()
    yield from coroutine_generator()