summaryrefslogtreecommitdiff
path: root/pylint/test/functional/nonlocal_without_binding.py
blob: 0501dd8924e9353ad9621ff93f1018368f96e83d (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
""" Checks that reversed() receive proper argument """
# pylint: disable=missing-docstring,invalid-name,unused-variable
# pylint: disable=too-few-public-methods,no-self-use,no-absolute-import

def test():
    def parent():
        a = 42
        def stuff():
            nonlocal a

    c = 24
    def parent2():
        a = 42
        def stuff():
            def other_stuff():
                nonlocal a
                nonlocal c

b = 42
def func():
    def other_func():
        nonlocal b  # [nonlocal-without-binding]

class SomeClass(object):
    nonlocal x # [nonlocal-without-binding]

    def func(self):
        nonlocal some_attr # [nonlocal-without-binding]