[Python-checkins] r84681 - python/branches/py3k/Lib/test/test_syntax.py

amaury.forgeotdarc python-checkins at python.org
Fri Sep 10 21:47:43 CEST 2010


Author: amaury.forgeotdarc
Date: Fri Sep 10 21:47:43 2010
New Revision: 84681

Log:
The "if 1": trick seems cleaner that the one with regular expressions.
Use it here again.


Modified:
   python/branches/py3k/Lib/test/test_syntax.py

Modified: python/branches/py3k/Lib/test/test_syntax.py
==============================================================================
--- python/branches/py3k/Lib/test/test_syntax.py	(original)
+++ python/branches/py3k/Lib/test/test_syntax.py	Fri Sep 10 21:47:43 2010
@@ -550,13 +550,13 @@
     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 @@
         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):


More information about the Python-checkins mailing list