[Python-checkins] r73031 - python/trunk/Lib/test/test_grammar.py
benjamin.peterson
python-checkins at python.org
Fri May 29 23:48:20 CEST 2009
Author: benjamin.peterson
Date: Fri May 29 23:48:19 2009
New Revision: 73031
Log:
add with statements
Modified:
python/trunk/Lib/test/test_grammar.py
Modified: python/trunk/Lib/test/test_grammar.py
==============================================================================
--- python/trunk/Lib/test/test_grammar.py (original)
+++ python/trunk/Lib/test/test_grammar.py Fri May 29 23:48:19 2009
@@ -920,6 +920,26 @@
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):
More information about the Python-checkins
mailing list