diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-05-29 21:48:19 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-05-29 21:48:19 (GMT) |
commit | 465089271fe32e8e5c573abeca13489553d27982 (patch) | |
tree | d993f493482b9b56f711cc755d2f83b156ac03eb | |
parent | b09f19836208148358d408c06ffd66035cdaa69e (diff) | |
download | cpython-465089271fe32e8e5c573abeca13489553d27982.zip cpython-465089271fe32e8e5c573abeca13489553d27982.tar.gz cpython-465089271fe32e8e5c573abeca13489553d27982.tar.bz2 |
add with statements
-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 f8cef6a..17f9f4c 100644 --- a/Lib/test/test_grammar.py +++ b/Lib/test/test_grammar.py @@ -920,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): |