summaryrefslogtreecommitdiff
path: root/tests/functional/u/used/used_before_assignment_issue626.py
blob: cb9fc100e6484dbd40380f966063f1d54bf82610 (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
# pylint: disable=missing-docstring,invalid-name
def main1():
    try:
        raise ValueError
    except ValueError as e:  # [unused-variable]
        pass

    print(e)  # [used-before-assignment]


def main2():
    try:
        raise ValueError
    except ValueError as e:
        print(e)


def main3():
    try:
        raise ValueError
    except ValueError as e:  # [unused-variable]
        pass

    e = 10
    print(e)


def main4():
    try:
        raise ValueError
    except ValueError as e:  # [unused-variable]
        pass

    try:
        raise ValueError
    except ValueError as e:
        pass

    try:
        raise ValueError
    except ValueError as e:
        pass

    print(e)  # [used-before-assignment]


def main5():
    try:
        print([e for e in range(3) if e])
    except ValueError as e:
        print(e)