summaryrefslogtreecommitdiffstats
path: root/Lib/lib2to3/tests/test_fixers.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2011-03-08 04:50:37 (GMT)
committerBenjamin Peterson <benjamin@python.org>2011-03-08 04:50:37 (GMT)
commit49d7149e6d12ee878fcf30d703150a5d00f3908d (patch)
tree14ab9f55ebf37924c78f5a0153848f945ebd012b /Lib/lib2to3/tests/test_fixers.py
parent3f84b07816fc63dd4996146bdd757f6bc81c54a9 (diff)
downloadcpython-49d7149e6d12ee878fcf30d703150a5d00f3908d.zip
cpython-49d7149e6d12ee878fcf30d703150a5d00f3908d.tar.gz
cpython-49d7149e6d12ee878fcf30d703150a5d00f3908d.tar.bz2
transform izip_longest #11424
Diffstat (limited to 'Lib/lib2to3/tests/test_fixers.py')
-rw-r--r--Lib/lib2to3/tests/test_fixers.py38
1 files changed, 26 insertions, 12 deletions
diff --git a/Lib/lib2to3/tests/test_fixers.py b/Lib/lib2to3/tests/test_fixers.py
index 0e11f38..43184e1 100644
--- a/Lib/lib2to3/tests/test_fixers.py
+++ b/Lib/lib2to3/tests/test_fixers.py
@@ -3623,16 +3623,24 @@ class Test_itertools(FixerTestCase):
a = """%s(f, a)"""
self.checkall(b, a)
- def test_2(self):
+ def test_qualified(self):
b = """itertools.ifilterfalse(a, b)"""
a = """itertools.filterfalse(a, b)"""
self.check(b, a)
- def test_4(self):
+ b = """itertools.izip_longest(a, b)"""
+ a = """itertools.zip_longest(a, b)"""
+ self.check(b, a)
+
+ def test_2(self):
b = """ifilterfalse(a, b)"""
a = """filterfalse(a, b)"""
self.check(b, a)
+ b = """izip_longest(a, b)"""
+ a = """zip_longest(a, b)"""
+ self.check(b, a)
+
def test_space_1(self):
b = """ %s(f, a)"""
a = """ %s(f, a)"""
@@ -3643,9 +3651,14 @@ class Test_itertools(FixerTestCase):
a = """ itertools.filterfalse(a, b)"""
self.check(b, a)
+ b = """ itertools.izip_longest(a, b)"""
+ a = """ itertools.zip_longest(a, b)"""
+ self.check(b, a)
+
def test_run_order(self):
self.assert_runs_after('map', 'zip', 'filter')
+
class Test_itertools_imports(FixerTestCase):
fixer = 'itertools_imports'
@@ -3696,18 +3709,19 @@ class Test_itertools_imports(FixerTestCase):
s = "from itertools import bar as bang"
self.unchanged(s)
- def test_ifilter(self):
- b = "from itertools import ifilterfalse"
- a = "from itertools import filterfalse"
- self.check(b, a)
+ def test_ifilter_and_zip_longest(self):
+ for name in "filterfalse", "zip_longest":
+ b = "from itertools import i%s" % (name,)
+ a = "from itertools import %s" % (name,)
+ self.check(b, a)
- b = "from itertools import imap, ifilterfalse, foo"
- a = "from itertools import filterfalse, foo"
- self.check(b, a)
+ b = "from itertools import imap, i%s, foo" % (name,)
+ a = "from itertools import %s, foo" % (name,)
+ self.check(b, a)
- b = "from itertools import bar, ifilterfalse, foo"
- a = "from itertools import bar, filterfalse, foo"
- self.check(b, a)
+ b = "from itertools import bar, i%s, foo" % (name,)
+ a = "from itertools import bar, %s, foo" % (name,)
+ self.check(b, a)
def test_import_star(self):
s = "from itertools import *"