Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Static Public Attributes
lib2to3.tests.test_fixers.Test_itertools Class Reference
Inheritance diagram for lib2to3.tests.test_fixers.Test_itertools:
Inheritance graph
[legend]
Collaboration diagram for lib2to3.tests.test_fixers.Test_itertools:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def checkall
def test_0
def test_1
def test_qualified
def test_2
def test_space_1
def test_space_2
def test_run_order
def setUp
def check
def warns
def warns_unchanged
def unchanged
def assert_runs_after

Public Attributes

 refactor
 fixer_log
 filename

Static Public Attributes

string fixer = "itertools"

Detailed Description

Definition at line 3601 of file test_fixers.py.


Member Function Documentation

def lib2to3.tests.test_fixers.FixerTestCase.assert_runs_after (   self,
  names 
) [inherited]

Definition at line 56 of file test_fixers.py.

00056 
00057     def assert_runs_after(self, *names):
00058         fixes = [self.fixer]
00059         fixes.extend(names)
00060         r = support.get_refactorer("lib2to3", fixes)
00061         (pre, post) = r.get_fixers()
00062         n = "fix_" + self.fixer
00063         if post and post[-1].__class__.__module__.endswith(n):
00064             # We're the last fixer to run
00065             return
00066         if pre and pre[-1].__class__.__module__.endswith(n) and not post:
00067             # We're the last in pre and post is empty
00068             return
00069         self.fail("Fixer run order (%s) is incorrect; %s should be last."\
00070                %(", ".join([x.__class__.__module__ for x in (pre+post)]), n))

Here is the call graph for this function:

Here is the caller graph for this function:

def lib2to3.tests.test_fixers.FixerTestCase.check (   self,
  before,
  after,
  ignore_warnings = False 
) [inherited]

Definition at line 36 of file test_fixers.py.

00036 
00037     def check(self, before, after, ignore_warnings=False):
00038         tree = self._check(before, after)
00039         self.assertTrue(tree.was_changed)
00040         if not ignore_warnings:
00041             self.assertEqual(self.fixer_log, [])

Here is the call graph for this function:

def lib2to3.tests.test_fixers.Test_itertools.checkall (   self,
  before,
  after 
)

Definition at line 3604 of file test_fixers.py.

03604 
03605     def checkall(self, before, after):
03606         # Because we need to check with and without the itertools prefix
03607         # and on each of the three functions, these loops make it all
03608         # much easier
03609         for i in ('itertools.', ''):
03610             for f in ('map', 'filter', 'zip'):
03611                 b = before %(i+'i'+f)
03612                 a = after %(f)
03613                 self.check(b, a)

Here is the call graph for this function:

def lib2to3.tests.test_fixers.FixerTestCase.setUp (   self,
  fix_list = None,
  fixer_pkg = "lib2to3",
  options = None 
) [inherited]

Definition at line 18 of file test_fixers.py.

00018 
00019     def setUp(self, fix_list=None, fixer_pkg="lib2to3", options=None):
00020         if fix_list is None:
00021             fix_list = [self.fixer]
00022         self.refactor = support.get_refactorer(fixer_pkg, fix_list, options)
00023         self.fixer_log = []
00024         self.filename = "<string>"
00025 
00026         for fixer in chain(self.refactor.pre_order,
00027                            self.refactor.post_order):
00028             fixer.log = self.fixer_log

Here is the caller graph for this function:

Definition at line 3614 of file test_fixers.py.

03614 
03615     def test_0(self):
03616         # A simple example -- test_1 covers exactly the same thing,
03617         # but it's not quite as clear.
03618         b = "itertools.izip(a, b)"
03619         a = "zip(a, b)"
03620         self.check(b, a)

Here is the call graph for this function:

Definition at line 3621 of file test_fixers.py.

03621 
03622     def test_1(self):
03623         b = """%s(f, a)"""
03624         a = """%s(f, a)"""
03625         self.checkall(b, a)

Here is the call graph for this function:

Definition at line 3635 of file test_fixers.py.

03635 
03636     def test_2(self):
03637         b = """ifilterfalse(a, b)"""
03638         a = """filterfalse(a, b)"""
03639         self.check(b, a)
03640 
03641         b = """izip_longest(a, b)"""
03642         a = """zip_longest(a, b)"""
03643         self.check(b, a)

Here is the call graph for this function:

Definition at line 3626 of file test_fixers.py.

03626 
03627     def test_qualified(self):
03628         b = """itertools.ifilterfalse(a, b)"""
03629         a = """itertools.filterfalse(a, b)"""
03630         self.check(b, a)
03631 
03632         b = """itertools.izip_longest(a, b)"""
03633         a = """itertools.zip_longest(a, b)"""
03634         self.check(b, a)

Here is the call graph for this function:

Definition at line 3658 of file test_fixers.py.

03658 
03659     def test_run_order(self):
03660         self.assert_runs_after('map', 'zip', 'filter')
03661 

Here is the call graph for this function:

Definition at line 3644 of file test_fixers.py.

03644 
03645     def test_space_1(self):
03646         b = """    %s(f, a)"""
03647         a = """    %s(f, a)"""
03648         self.checkall(b, a)

Here is the call graph for this function:

Definition at line 3649 of file test_fixers.py.

03649 
03650     def test_space_2(self):
03651         b = """    itertools.ifilterfalse(a, b)"""
03652         a = """    itertools.filterfalse(a, b)"""
03653         self.check(b, a)
03654 
03655         b = """    itertools.izip_longest(a, b)"""
03656         a = """    itertools.zip_longest(a, b)"""
03657         self.check(b, a)

Here is the call graph for this function:

def lib2to3.tests.test_fixers.FixerTestCase.unchanged (   self,
  before,
  ignore_warnings = False 
) [inherited]

Definition at line 51 of file test_fixers.py.

00051 
00052     def unchanged(self, before, ignore_warnings=False):
00053         self._check(before, before)
00054         if not ignore_warnings:
00055             self.assertEqual(self.fixer_log, [])

Here is the call graph for this function:

def lib2to3.tests.test_fixers.FixerTestCase.warns (   self,
  before,
  after,
  message,
  unchanged = False 
) [inherited]

Definition at line 42 of file test_fixers.py.

00042 
00043     def warns(self, before, after, message, unchanged=False):
00044         tree = self._check(before, after)
00045         self.assertTrue(message in "".join(self.fixer_log))
00046         if not unchanged:
00047             self.assertTrue(tree.was_changed)

Here is the call graph for this function:

Here is the caller graph for this function:

def lib2to3.tests.test_fixers.FixerTestCase.warns_unchanged (   self,
  before,
  message 
) [inherited]

Definition at line 48 of file test_fixers.py.

00048 
00049     def warns_unchanged(self, before, message):
00050         self.warns(before, before, message, unchanged=True)

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Reimplemented in lib2to3.tests.test_fixers.Test_import.

Definition at line 23 of file test_fixers.py.

Definition at line 3602 of file test_fixers.py.

Definition at line 22 of file test_fixers.py.

Definition at line 21 of file test_fixers.py.


The documentation for this class was generated from the following file: