Back to index

python3.2  3.2.2
Classes | Functions
lib2to3.tests.test_fixers Namespace Reference

Classes

class  FixerTestCase
class  Test_ne
class  Test_has_key
class  Test_apply
class  Test_intern
class  Test_reduce
class  Test_print
class  Test_exec
class  Test_repr
class  Test_except
class  Test_raise
class  Test_throw
class  Test_long
class  Test_execfile
class  Test_isinstance
class  Test_dict
class  Test_xrange
class  Test_xrange_with_reduce
class  Test_raw_input
class  Test_funcattrs
class  Test_xreadlines
class  ImportsFixerTests
class  Test_imports
class  Test_imports2
class  Test_imports_fixer_order
class  Test_urllib
class  Test_input
class  Test_tuple_params
class  Test_methodattrs
class  Test_next
class  Test_nonzero
class  Test_numliterals
class  Test_renames
class  Test_unicode
class  Test_callable
class  Test_filter
class  Test_map
class  Test_zip
class  Test_standarderror
class  Test_types
class  Test_idioms
class  Test_basestring
class  Test_buffer
class  Test_future
class  Test_itertools
class  Test_itertools_imports
class  Test_import
class  Test_set_literal
class  Test_sys_exc
class  Test_paren
class  Test_metaclass
class  Test_getcwdu
class  Test_operator
class  Test_exitfunc

Functions

def test_filter_nochange
 b = """x = filter(f, 'abc')[0]""" a = """x = list(filter(f, 'abc'))[0]""" self.check(b, a)
def test_future_builtins
def test_map_nochange
 b = """x = map(f, 'abc')[0]""" a = """x = list(map(f, 'abc'))[0]""" self.check(b, a)

Detailed Description

Test suite for the fixer modules 

Function Documentation

b = """x = filter(f, 'abc')[0]""" a = """x = list(filter(f, 'abc'))[0]""" self.check(b, a)

Definition at line 2955 of file test_fixers.py.

02955 
02956     def test_filter_nochange(self):
02957         a = """b.join(filter(f, 'abc'))"""
02958         self.unchanged(a)
02959         a = """(a + foo(5)).join(filter(f, 'abc'))"""
02960         self.unchanged(a)
02961         a = """iter(filter(f, 'abc'))"""
02962         self.unchanged(a)
02963         a = """list(filter(f, 'abc'))"""
02964         self.unchanged(a)
02965         a = """list(filter(f, 'abc'))[0]"""
02966         self.unchanged(a)
02967         a = """set(filter(f, 'abc'))"""
02968         self.unchanged(a)
02969         a = """set(filter(f, 'abc')).pop()"""
02970         self.unchanged(a)
02971         a = """tuple(filter(f, 'abc'))"""
02972         self.unchanged(a)
02973         a = """any(filter(f, 'abc'))"""
02974         self.unchanged(a)
02975         a = """all(filter(f, 'abc'))"""
02976         self.unchanged(a)
02977         a = """sum(filter(f, 'abc'))"""
02978         self.unchanged(a)
02979         a = """sorted(filter(f, 'abc'))"""
02980         self.unchanged(a)
02981         a = """sorted(filter(f, 'abc'), key=blah)"""
02982         self.unchanged(a)
02983         a = """sorted(filter(f, 'abc'), key=blah)[0]"""
02984         self.unchanged(a)
02985         a = """for i in filter(f, 'abc'): pass"""
02986         self.unchanged(a)
02987         a = """[x for x in filter(f, 'abc')]"""
02988         self.unchanged(a)
02989         a = """(x for x in filter(f, 'abc'))"""
02990         self.unchanged(a)

Definition at line 2991 of file test_fixers.py.

02991 
02992     def test_future_builtins(self):
02993         a = "from future_builtins import spam, filter; filter(f, 'ham')"
02994         self.unchanged(a)
02995 
02996         b = """from future_builtins import spam; x = filter(f, 'abc')"""
02997         a = """from future_builtins import spam; x = list(filter(f, 'abc'))"""
02998         self.check(b, a)
02999 
03000         a = "from future_builtins import *; filter(f, 'ham')"
03001         self.unchanged(a)

b = """x = map(f, 'abc')[0]""" a = """x = list(map(f, 'abc'))[0]""" self.check(b, a)

Definition at line 3063 of file test_fixers.py.

03063 
03064     def test_map_nochange(self):
03065         a = """b.join(map(f, 'abc'))"""
03066         self.unchanged(a)
03067         a = """(a + foo(5)).join(map(f, 'abc'))"""
03068         self.unchanged(a)
03069         a = """iter(map(f, 'abc'))"""
03070         self.unchanged(a)
03071         a = """list(map(f, 'abc'))"""
03072         self.unchanged(a)
03073         a = """list(map(f, 'abc'))[0]"""
03074         self.unchanged(a)
03075         a = """set(map(f, 'abc'))"""
03076         self.unchanged(a)
03077         a = """set(map(f, 'abc')).pop()"""
03078         self.unchanged(a)
03079         a = """tuple(map(f, 'abc'))"""
03080         self.unchanged(a)
03081         a = """any(map(f, 'abc'))"""
03082         self.unchanged(a)
03083         a = """all(map(f, 'abc'))"""
03084         self.unchanged(a)
03085         a = """sum(map(f, 'abc'))"""
03086         self.unchanged(a)
03087         a = """sorted(map(f, 'abc'))"""
03088         self.unchanged(a)
03089         a = """sorted(map(f, 'abc'), key=blah)"""
03090         self.unchanged(a)
03091         a = """sorted(map(f, 'abc'), key=blah)[0]"""
03092         self.unchanged(a)
03093         a = """for i in map(f, 'abc'): pass"""
03094         self.unchanged(a)
03095         a = """[x for x in map(f, 'abc')]"""
03096         self.unchanged(a)
03097         a = """(x for x in map(f, 'abc'))"""
03098         self.unchanged(a)