[pypy-commit] pypy fix-global: Added tests for bugfix
stevie_92
pypy.commits at gmail.com
Wed Mar 1 06:43:09 EST 2017
Author: Stefan Beyer <home at sbeyer.at>
Branch: fix-global
Changeset: r90435:b8d66cc71819
Date: 2017-02-28 21:59 +0100
http://bitbucket.org/pypy/pypy/changeset/b8d66cc71819/
Log: Added tests for bugfix
diff --git a/pypy/interpreter/astcompiler/test/test_misc.py b/pypy/interpreter/astcompiler/test/test_misc.py
--- a/pypy/interpreter/astcompiler/test/test_misc.py
+++ b/pypy/interpreter/astcompiler/test/test_misc.py
@@ -12,3 +12,23 @@
assert mangle("__foo", "__Bar") == "_Bar__foo"
assert mangle("__foo", "___") == "__foo"
assert mangle("___foo", "__Bar") == "_Bar___foo"
+
+def app_test_warning_to_error_translation():
+ import warnings
+
+ with warnings.catch_warnings():
+ warnings.filterwarnings("error", module="<test string>")
+ statement = """\
+def wrong1():
+ a = 1
+ b = 2
+ global a
+ global b
+"""
+ try:
+ compile(statement, '<test string>', 'exec')
+ except SyntaxError as err:
+ assert err.lineno is not None
+ assert err.filename is not None
+ assert err.offset is not None
+ assert err.message is not None
More information about the pypy-commit
mailing list