Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f17ab89

Browse files
committed
Merged revisions 73031 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r73031 | benjamin.peterson | 2009-05-29 16:48:19 -0500 (Fri, 29 May 2009) | 1 line add with statements ........
1 parent 3308e80 commit f17ab89

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

Lib/test/test_grammar.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,26 @@ def testComprehensionSpecials(self):
868868
self.assertEqual([x for x, in [(4,), (5,), (6,)]], [4, 5, 6])
869869
self.assertEqual(list(x for x, in [(7,), (8,), (9,)]), [7, 8, 9])
870870

871+
def test_with_statement(self):
872+
class manager(object):
873+
def __enter__(self):
874+
return (1, 2)
875+
def __exit__(self, *args):
876+
pass
877+
878+
with manager():
879+
pass
880+
with manager() as x:
881+
pass
882+
with manager() as (x, y):
883+
pass
884+
with manager(), manager():
885+
pass
886+
with manager() as x, manager() as y:
887+
pass
888+
with manager() as x, manager():
889+
pass
890+
871891
def testIfElseExpr(self):
872892
# Test ifelse expressions in various cases
873893
def _checkeval(msg, ret):

0 commit comments

Comments
 (0)