summaryrefslogtreecommitdiff
path: root/tests/functional/u/use/used_before_assignment_issue1081.py
blob: 0c59ccebe0ca60d4ee6b2d3089f57c0f0c46321e (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
# pylint: disable=missing-docstring,invalid-name,too-few-public-methods, useless-object-inheritance

x = 24


def used_before_assignment_1(a):
    if x == a:  # [used-before-assignment]
        for x in [1, 2]:  # [redefined-outer-name]
            pass


def used_before_assignment_2(a):
    if x == a:  # [used-before-assignment]
        pass
    x = 2  # [redefined-outer-name]


def used_before_assignment_3(a):
    if x == a:  # [used-before-assignment]
        if x > 3:
            x = 2  # [redefined-outer-name]


def not_used_before_assignment(a):
    if x == a:
        pass


def not_used_before_assignment_2(a):
    x = 3  # [redefined-outer-name]
    if x == a:
        pass


def func(something):
    return something ** 3


class FalsePositive(object):
    x = func(x)