summaryrefslogtreecommitdiff
path: root/test/input/func_used_before_assignment_py30.py
blob: 3765d6b1273ffc017d65f285f832ad67cb93a01e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"""Check for nonlocal and used-before-assignment"""
# pylint: disable=missing-docstring, unused-variable

__revision__ = 0

def test_ok():
    """ uses nonlocal """
    cnt = 1
    def wrap():
        nonlocal cnt
        cnt = cnt + 1
    wrap()

def test_fail():
    """ doesn't use nonlocal """
    cnt = 1
    def wrap():
        cnt = cnt + 1
    wrap()