[Python-checkins] r73848 - sandbox/trunk/2to3/lib2to3/tests/test_refactor.py

alexandre.vassalotti python-checkins at python.org
Sun Jul 5 06:38:19 CEST 2009


Author: alexandre.vassalotti
Date: Sun Jul  5 06:38:19 2009
New Revision: 73848

Log:
Fix test_refactor_stdin to handle print_output() method with 4 arguments.


Modified:
   sandbox/trunk/2to3/lib2to3/tests/test_refactor.py

Modified: sandbox/trunk/2to3/lib2to3/tests/test_refactor.py
==============================================================================
--- sandbox/trunk/2to3/lib2to3/tests/test_refactor.py	(original)
+++ sandbox/trunk/2to3/lib2to3/tests/test_refactor.py	Sun Jul  5 06:38:19 2009
@@ -106,10 +106,10 @@
 
         class MyRT(refactor.RefactoringTool):
 
-            def print_output(self, lines):
-                diff_lines.extend(lines)
+            def print_output(self, old_text, new_text, filename, equal):
+                results.extend([old_text, new_text, filename, equal])
 
-        diff_lines = []
+        results = []
         rt = MyRT(_DEFAULT_FIXERS)
         save = sys.stdin
         sys.stdin = StringIO.StringIO("def parrot(): pass\n\n")
@@ -117,12 +117,10 @@
             rt.refactor_stdin()
         finally:
             sys.stdin = save
-        expected = """--- <stdin> (original)
-+++ <stdin> (refactored)
-@@ -1,2 +1,2 @@
--def parrot(): pass
-+def cheese(): pass""".splitlines()
-        self.assertEqual(diff_lines[:-1], expected)
+        expected = ["def parrot(): pass\n\n",
+                    "def cheese(): pass\n\n",
+                    "<stdin>", False]
+        self.assertEqual(results, expected)
 
     def check_file_refactoring(self, test_file, fixers=_2TO3_FIXERS):
         def read_file():


More information about the Python-checkins mailing list