[Python-checkins] r66418 - in sandbox/trunk/2to3/lib2to3: fixes/fix_print.py tests/test_fixers.py

benjamin.peterson python-checkins at python.org
Sat Sep 13 01:49:48 CEST 2008


Author: benjamin.peterson
Date: Sat Sep 13 01:49:48 2008
New Revision: 66418

Log:
a trival fix to get a few more print corner cases #2899

Modified:
   sandbox/trunk/2to3/lib2to3/fixes/fix_print.py
   sandbox/trunk/2to3/lib2to3/tests/test_fixers.py

Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_print.py
==============================================================================
--- sandbox/trunk/2to3/lib2to3/fixes/fix_print.py	(original)
+++ sandbox/trunk/2to3/lib2to3/fixes/fix_print.py	Sat Sep 13 01:49:48 2008
@@ -29,7 +29,7 @@
 class FixPrint(fixer_base.ConditionalFix):
 
     PATTERN = """
-              simple_stmt< bare='print' any > | print_stmt
+              simple_stmt< any* bare='print' any* > | print_stmt
               """
 
     skip_on = '__future__.print_function'

Modified: sandbox/trunk/2to3/lib2to3/tests/test_fixers.py
==============================================================================
--- sandbox/trunk/2to3/lib2to3/tests/test_fixers.py	(original)
+++ sandbox/trunk/2to3/lib2to3/tests/test_fixers.py	Sat Sep 13 01:49:48 2008
@@ -385,6 +385,16 @@
         a = """print()"""
         self.check(b, a)
 
+    def test_4(self):
+        # from bug 3000
+        b = """print whatever; print"""
+        a = """print(whatever); print()"""
+        self.check(b, a)
+
+    def test_5(self):
+        b = """print; print whatever;"""
+        a = """print(); print(whatever);"""
+
     def test_tuple(self):
         b = """print (a, b, c)"""
         a = """print((a, b, c))"""


More information about the Python-checkins mailing list