diff options
author | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2010-09-10 19:47:43 (GMT) |
---|---|---|
committer | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2010-09-10 19:47:43 (GMT) |
commit | fe7b40533cdd61c7cc69171e476a965389146a28 (patch) | |
tree | b8f7edeeb004d15c7d2265e2ed9c851a58139d35 /Lib | |
parent | 8e6b407d6fdca02f84409790a4c1f92478ac8dc1 (diff) | |
download | cpython-fe7b40533cdd61c7cc69171e476a965389146a28.zip cpython-fe7b40533cdd61c7cc69171e476a965389146a28.tar.gz cpython-fe7b40533cdd61c7cc69171e476a965389146a28.tar.bz2 |
The "if 1": trick seems cleaner that the one with regular expressions.
Use it here again.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_syntax.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py index 7117ef3..f354311 100644 --- a/Lib/test/test_syntax.py +++ b/Lib/test/test_syntax.py @@ -550,13 +550,13 @@ class SyntaxTestCase(unittest.TestCase): def test_global_err_then_warn(self): # Bug tickler: The SyntaxError raised for one global statement # shouldn't be clobbered by a SyntaxWarning issued for a later one. - source = re.sub('(?m)^ *:', '', """\ - :def error(a): - : global a # SyntaxError - :def warning(): - : b = 1 - : global b # SyntaxWarning - :""") + source = """if 1: + def error(a): + global a # SyntaxError + def warning(): + b = 1 + global b # SyntaxWarning + """ warnings.filterwarnings(action='ignore', category=SyntaxWarning) self._check_error(source, "global") warnings.filters.pop(0) @@ -565,12 +565,12 @@ class SyntaxTestCase(unittest.TestCase): self._check_error("break", "outside loop") def test_delete_deref(self): - source = re.sub('(?m)^ *:', '', """\ - :def foo(x): - : def bar(): - : print(x) - : del x - :""") + source = """if 1: + def foo(x): + def bar(): + print(x) + del x + """ self._check_error(source, "nested scope") def test_unexpected_indent(self): |