[Python-checkins] r65887 - in sandbox/trunk/2to3/lib2to3: fixes/fix_raw_input.py tests/test_fixers.py
benjamin.peterson
python-checkins at python.org
Wed Aug 20 00:45:04 CEST 2008
Author: benjamin.peterson
Date: Wed Aug 20 00:45:04 2008
New Revision: 65887
Log:
allow the raw_input fixer to handle calls after the raw_input (ie. raw_input().split())
Modified:
sandbox/trunk/2to3/lib2to3/fixes/fix_raw_input.py
sandbox/trunk/2to3/lib2to3/tests/test_fixers.py
Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_raw_input.py
==============================================================================
--- sandbox/trunk/2to3/lib2to3/fixes/fix_raw_input.py (original)
+++ sandbox/trunk/2to3/lib2to3/fixes/fix_raw_input.py Wed Aug 20 00:45:04 2008
@@ -8,7 +8,7 @@
class FixRawInput(fixer_base.BaseFix):
PATTERN = """
- power< name='raw_input' trailer< '(' [any] ')' > >
+ power< name='raw_input' trailer< '(' [any] ')' > any* >
"""
def transform(self, node, results):
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 Wed Aug 20 00:45:04 2008
@@ -1338,6 +1338,21 @@
a = """x = input(foo(a) + 6)"""
self.check(b, a)
+ def test_5(self):
+ b = """x = raw_input(invite).split()"""
+ a = """x = input(invite).split()"""
+ self.check(b, a)
+
+ def test_6(self):
+ b = """x = raw_input(invite) . split ()"""
+ a = """x = input(invite) . split ()"""
+ self.check(b, a)
+
+ def test_8(self):
+ b = "x = int(raw_input())"
+ a = "x = int(input())"
+ self.check(b, a)
+
class Test_funcattrs(FixerTestCase):
fixer = "funcattrs"
More information about the Python-checkins
mailing list