Author: Ronan Lamy <[email protected]>
Branch: framestate
Changeset: r75924:42000e974b69
Date: 2015-02-15 04:19 +0000
http://bitbucket.org/pypy/pypy/changeset/42000e974b69/
Log: add 2 tests for with blocks
diff --git a/rpython/flowspace/test/test_objspace.py
b/rpython/flowspace/test/test_objspace.py
--- a/rpython/flowspace/test/test_objspace.py
+++ b/rpython/flowspace/test/test_objspace.py
@@ -960,6 +960,20 @@
'simple_call': 4, # __enter__, g and 2 possible calls to __exit__
}
+ def test_return_in_with(self):
+ def f(x):
+ with x:
+ return 1
+ self.codetest(f)
+
+ def test_break_in_with(self):
+ def f(n, x):
+ for i in range(n):
+ with x:
+ break
+ return 1
+ self.codetest(f)
+
def monkey_patch_code(self, code, stacksize, flags, codestring, names,
varnames):
c = code
return types.CodeType(c.co_argcount, c.co_nlocals, stacksize, flags,
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit