summaryrefslogtreecommitdiffstats
path: root/Lib/lib2to3/tests/data/py2_test_grammar.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/lib2to3/tests/data/py2_test_grammar.py')
-rw-r--r--Lib/lib2to3/tests/data/py2_test_grammar.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/Lib/lib2to3/tests/data/py2_test_grammar.py b/Lib/lib2to3/tests/data/py2_test_grammar.py
index dc794e2..17f9f4c 100644
--- a/Lib/lib2to3/tests/data/py2_test_grammar.py
+++ b/Lib/lib2to3/tests/data/py2_test_grammar.py
@@ -1,5 +1,3 @@
-# Python 2's Lib/test/test_grammar.py (r66189)
-
# Python test set -- part 1, grammar.
# This just tests whether the parser accepts them all.
@@ -922,6 +920,26 @@ hello world
self.assertEqual([x for x, in [(4,), (5,), (6,)]], [4, 5, 6])
self.assertEqual(list(x for x, in [(7,), (8,), (9,)]), [7, 8, 9])
+ def test_with_statement(self):
+ class manager(object):
+ def __enter__(self):
+ return (1, 2)
+ def __exit__(self, *args):
+ pass
+
+ with manager():
+ pass
+ with manager() as x:
+ pass
+ with manager() as (x, y):
+ pass
+ with manager(), manager():
+ pass
+ with manager() as x, manager() as y:
+ pass
+ with manager() as x, manager():
+ pass
+
def testIfElseExpr(self):
# Test ifelse expressions in various cases
def _checkeval(msg, ret):