Author: Armin Rigo <[email protected]>
Branch: py3.5
Changeset: r88808:2647ec2b2b73
Date: 2016-12-02 09:48 +0100
http://bitbucket.org/pypy/pypy/changeset/2647ec2b2b73/
Log: Some failing tests for the compiler
diff --git a/pypy/interpreter/test/test_compiler.py
b/pypy/interpreter/test/test_compiler.py
--- a/pypy/interpreter/test/test_compiler.py
+++ b/pypy/interpreter/test/test_compiler.py
@@ -374,6 +374,44 @@
ex.normalize_exception(space)
assert ex.match(space, space.w_SyntaxError)
+ def test_no_warning_run(self):
+ space = self.space
+ w_mod = space.appexec((), '():\n import warnings\n return warnings\n')
#sys.getmodule('warnings')
+ w_filterwarnings = space.getattr(w_mod, space.wrap('filterwarnings'))
+ filter_arg = Arguments(space, [ space.wrap('error') ], ["module"],
+ [space.wrap("<tmp>")])
+ for code in ['''
+class C:
+ global __class__
+ __class__ = 42
+def testing():
+ return __class__
+''', '''
+def testing():
+ __class__ = 0
+ def f():
+ nonlocal __class__
+ __class__ = 42
+ f()
+ return __class__
+''', '''
+class Y:
+ class X:
+ nonlocal __class__
+ __class__ = 42
+def testing():
+ return 42 # 'Y.__class__' is *not* set to 42, at least on CPython 3.5.2
+'''
+ ]:
+ space.call_args(w_filterwarnings, filter_arg)
+ pycode = self.compiler.compile(code, '<tmp>', 'exec', 0)
+ space.call_method(w_mod, 'resetwarnings')
+ w_d = space.newdict()
+ pycode.exec_code(space, w_d, w_d)
+ w_res = space.call_function(
+ space.getitem(w_d, space.wrap('testing')))
+ assert space.unwrap(w_res) == 42
+
def test_firstlineno(self):
snippet = str(py.code.Source(r'''
def f(): "line 2"
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit