summaryrefslogtreecommitdiff
path: root/pylint/test/functional/confusing_with_statement.py
diff options
context:
space:
mode:
Diffstat (limited to 'pylint/test/functional/confusing_with_statement.py')
-rw-r--r--pylint/test/functional/confusing_with_statement.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/pylint/test/functional/confusing_with_statement.py b/pylint/test/functional/confusing_with_statement.py
new file mode 100644
index 0000000..1444a97
--- /dev/null
+++ b/pylint/test/functional/confusing_with_statement.py
@@ -0,0 +1,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