diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-05-29 21:55:57 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-05-29 21:55:57 (GMT) |
commit | f17ab89c7732c91679cc5e3d85497c4071d7781c (patch) | |
tree | 449da3e81532f92f5c699bb9a3316f24b4146981 /Lib | |
parent | 3308e802522d2ed1fbaac3c935af85fb444cc3c5 (diff) | |
download | cpython-f17ab89c7732c91679cc5e3d85497c4071d7781c.zip cpython-f17ab89c7732c91679cc5e3d85497c4071d7781c.tar.gz cpython-f17ab89c7732c91679cc5e3d85497c4071d7781c.tar.bz2 |
Merged revisions 73031 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r73031 | benjamin.peterson | 2009-05-29 16:48:19 -0500 (Fri, 29 May 2009) | 1 line
add with statements
........
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_grammar.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py index eadf1db..977f0b8 100644 --- a/Lib/test/test_grammar.py +++ b/Lib/test/test_grammar.py @@ -868,6 +868,26 @@ class GrammarTests(unittest.TestCase): 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): |