summaryrefslogtreecommitdiff
path: root/pylint/test/functional/confusing_with_statement.py
blob: 1444a9795b58a5cd9ec227e6657ca4bdfaa31714 (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 emited
# 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