Index: Lib/lib2to3/fixes/fix_getcwdu.py =================================================================== --- Lib/lib2to3/fixes/fix_getcwdu.py (révision 0) +++ Lib/lib2to3/fixes/fix_getcwdu.py (révision 0) @@ -0,0 +1,19 @@ +""" +Fixer that changes os.getcwdu() to os.getcwd(). +""" +# Author: Victor Stinner + +# Local imports +from .. import fixer_base +from ..fixer_util import Name + +class FixGetcwdu(fixer_base.BaseFix): + + PATTERN = """ + power< 'os' trailer< dot='.' name='getcwdu' > trailer< '(' [any] ')' > > + """ + + def transform(self, node, results): + name = results["name"] + name.replace(Name("getcwd", prefix=name.get_prefix())) + Modification de propriétés sur Lib/lib2to3/fixes/fix_getcwdu.py ___________________________________________________________________ Nom : svn:eol-style + native Index: Lib/lib2to3/tests/test_fixers.py =================================================================== --- Lib/lib2to3/tests/test_fixers.py (révision 66750) +++ Lib/lib2to3/tests/test_fixers.py (copie de travail) @@ -3576,7 +3576,20 @@ a = """class m(a, arg=23, metaclass=Meta): pass""" self.check(b, a) +class Test_getcwdu(FixerTestCase): + fixer = 'getcwdu' + + def test_import(self): + b = """import os +cwd = os.getcwdu() +print "cwd=%s" % cwd""" + a = """import os +cwd = os.getcwd() +print "cwd=%s" % cwd""" + self.check(b, a) + + if __name__ == "__main__": import __main__ support.run_all_tests(__main__)