summaryrefslogtreecommitdiff
path: root/tests/functional/c/confusing_with_statement.py
blob: 7b8d494e43b2216491b098b8a172fb5fadd17f06 (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
# pylint: disable=undefined-variable,not-context-manager,missing-docstring

# both context managers are named
with one as first, two as second:
    pass

# first matched as tuple; this is ok
with one as (first, second), third:
    pass

# the first context manager doesn't have as name
with one, two as second:
    pass

# the second is a function call; this is ok
with one as first, two():
    pass

# nested with statements; make sure no message is emitted
# this could be a false positive on Py2
with one as first:
    with two:
        pass

# ambiguous looking with statement
with one as first, two:  # [confusing-with-statement]
    pass