All pastes #1438931 Raw Edit

2to3 patch (a little more generi

public python v1 · immutable
#1438931 ·published 2009-05-29 02:45 UTC
rendered paste body
--- lib2to3/tests/support.py	Wed May 27 22:07:21 2009 +0200+++ lib2to3/tests/support.py	Thu May 28 22:42:36 2009 -0400@@ -30,7 +30,7 @@ def reformat(string):     return dedent(string) + u"\n\n" -def get_refactorer(fixers=None, options=None):+def get_refactorer(pkg="lib2to3", fixers=None, options=None):     """     A convenience function for creating a RefactoringTool for tests. @@ -39,9 +39,11 @@     be passed to the RefactoringTool.     """     if fixers is not None:-        fixers = ["lib2to3.fixes.fix_" + fix for fix in fixers]+        fixers = [pkg + ".fixes.fix_" + fix for fix in fixers]+        for x in fixers:+            print x+'\n'     else:-        fixers = refactor.get_fixers_from_package("lib2to3.fixes")+        fixers = refactor.get_fixers_from_package(pkg + ".fixes")     options = options or {}     return refactor.RefactoringTool(fixers, options, explicit=True) --- lib2to3/tests/test_fixers.py	Wed May 27 22:07:21 2009 +0200+++ lib2to3/tests/test_fixers.py	Thu May 28 22:42:36 2009 -0400@@ -19,11 +19,12 @@   class FixerTestCase(support.TestCase):-    def setUp(self, fix_list=None):+    # Other test cases can subclass this class and replace "pkg" with their own.+    def setUp(self, fix_list=None, pkg="lib2to3"):         if fix_list is None:             fix_list = [self.fixer]         options = {"print_function" : False}-        self.refactor = support.get_refactorer(fix_list, options)+        self.refactor = support.get_refactorer(pkg=pkg, fixers=fix_list, options=options)         self.fixer_log = []         self.filename = u"<string>" @@ -62,7 +63,7 @@         fixes = [self.fixer]         fixes.extend(names)         options = {"print_function" : False}-        r = support.get_refactorer(fixes, options)+        r = support.get_refactorer(pkg="lib2to3", fixers=fixes, options=options)         (pre, post) = r.get_fixers()         n = "fix_" + self.fixer         if post and post[-1].__class__.__module__.endswith(n):