[Python-checkins] r56435 - in sandbox/trunk/2to3: fixes/fix_filter.py fixes/fix_map.py tests/test_fixers.py

collin.winter python-checkins at python.org
Wed Jul 18 00:12:54 CEST 2007


Author: collin.winter
Date: Wed Jul 18 00:12:54 2007
New Revision: 56435

Modified:
   sandbox/trunk/2to3/   (props changed)
   sandbox/trunk/2to3/fixes/fix_filter.py
   sandbox/trunk/2to3/fixes/fix_map.py
   sandbox/trunk/2to3/tests/test_fixers.py
Log:
Add join() method calls to the set of special contexts for fix_filter and fix_map.


Modified: sandbox/trunk/2to3/fixes/fix_filter.py
==============================================================================
--- sandbox/trunk/2to3/fixes/fix_filter.py	(original)
+++ sandbox/trunk/2to3/fixes/fix_filter.py	Wed Jul 18 00:12:54 2007
@@ -64,7 +64,8 @@
 
 P1 = """
 power<
-    ( 'iter' | 'list' | 'tuple' | 'sorted' | 'set' )
+    ( 'iter' | 'list' | 'tuple' | 'sorted' | 'set' |
+      (any* trailer< '.' 'join' >) )
     trailer< '(' node=any ')' >
     any*
 >

Modified: sandbox/trunk/2to3/fixes/fix_map.py
==============================================================================
--- sandbox/trunk/2to3/fixes/fix_map.py	(original)
+++ sandbox/trunk/2to3/fixes/fix_map.py	Wed Jul 18 00:12:54 2007
@@ -76,7 +76,8 @@
 
 P1 = """
 power<
-    ( 'iter' | 'list' | 'tuple' | 'sorted' | 'set' )
+    ( 'iter' | 'list' | 'tuple' | 'sorted' | 'set' |
+      (any* trailer< '.' 'join' >) )
     trailer< '(' node=any ')' >
     any*
 >

Modified: sandbox/trunk/2to3/tests/test_fixers.py
==============================================================================
--- sandbox/trunk/2to3/tests/test_fixers.py	(original)
+++ sandbox/trunk/2to3/tests/test_fixers.py	Wed Jul 18 00:12:54 2007
@@ -2192,6 +2192,10 @@
 ##         self.check(b, a)
 
     def test_filter_nochange(self):
+        a = """b.join(filter(f, 'abc'))"""
+        self.unchanged(a)
+        a = """(a + foo(5)).join(filter(f, 'abc'))"""
+        self.unchanged(a)
         a = """iter(filter(f, 'abc'))"""
         self.unchanged(a)
         a = """list(filter(f, 'abc'))"""
@@ -2257,6 +2261,10 @@
 ##         self.check(b, a)
 
     def test_map_nochange(self):
+        a = """b.join(map(f, 'abc'))"""
+        self.unchanged(a)
+        a = """(a + foo(5)).join(map(f, 'abc'))"""
+        self.unchanged(a)
         a = """iter(map(f, 'abc'))"""
         self.unchanged(a)
         a = """list(map(f, 'abc'))"""


More information about the Python-checkins mailing list