Back to index

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

List of all members.

Public Member Functions

def check
def test_zip_basic
def test_zip_nochange
def test_future_builtins
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 = "zip"

Detailed Description

Definition at line 3110 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:

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_zip.check (   self,
  b,
  a 
)

Definition at line 3113 of file test_fixers.py.

03113 
03114     def check(self, b, a):
03115         self.unchanged("from future_builtins import zip; " + b, a)
03116         super(Test_zip, 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 3162 of file test_fixers.py.

03162 
03163     def test_future_builtins(self):
03164         a = "from future_builtins import spam, zip, eggs; zip(a, b)"
03165         self.unchanged(a)
03166 
03167         b = """from future_builtins import spam, eggs; x = zip(a, b)"""
03168         a = """from future_builtins import spam, eggs; x = list(zip(a, b))"""
03169         self.check(b, a)
03170 
03171         a = "from future_builtins import *; zip(a, b)"
03172         self.unchanged(a)

Here is the call graph for this function:

Definition at line 3117 of file test_fixers.py.

03117 
03118     def test_zip_basic(self):
03119         b = """x = zip(a, b, c)"""
03120         a = """x = list(zip(a, b, c))"""
03121         self.check(b, a)
03122 
03123         b = """x = len(zip(a, b))"""
03124         a = """x = len(list(zip(a, b)))"""
03125         self.check(b, a)

Here is the call graph for this function:

Definition at line 3126 of file test_fixers.py.

03126 
03127     def test_zip_nochange(self):
03128         a = """b.join(zip(a, b))"""
03129         self.unchanged(a)
03130         a = """(a + foo(5)).join(zip(a, b))"""
03131         self.unchanged(a)
03132         a = """iter(zip(a, b))"""
03133         self.unchanged(a)
03134         a = """list(zip(a, b))"""
03135         self.unchanged(a)
03136         a = """list(zip(a, b))[0]"""
03137         self.unchanged(a)
03138         a = """set(zip(a, b))"""
03139         self.unchanged(a)
03140         a = """set(zip(a, b)).pop()"""
03141         self.unchanged(a)
03142         a = """tuple(zip(a, b))"""
03143         self.unchanged(a)
03144         a = """any(zip(a, b))"""
03145         self.unchanged(a)
03146         a = """all(zip(a, b))"""
03147         self.unchanged(a)
03148         a = """sum(zip(a, b))"""
03149         self.unchanged(a)
03150         a = """sorted(zip(a, b))"""
03151         self.unchanged(a)
03152         a = """sorted(zip(a, b), key=blah)"""
03153         self.unchanged(a)
03154         a = """sorted(zip(a, b), key=blah)[0]"""
03155         self.unchanged(a)
03156         a = """for i in zip(a, b): pass"""
03157         self.unchanged(a)
03158         a = """[x for x in zip(a, b)]"""
03159         self.unchanged(a)
03160         a = """(x for x in zip(a, b))"""
03161         self.unchanged(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 3111 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: