Back to index

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

List of all members.

Public Member Functions

def test_reduced
def test_comments
def test_none
def test_import_as
def test_ifilter_and_zip_longest
def test_import_star
def test_unchanged
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_imports'

Detailed Description

Definition at line 3662 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.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 3678 of file test_fixers.py.

03678 
03679     def test_comments(self):
03680         b = "#foo\nfrom itertools import imap, izip"
03681         a = "#foo\n"
03682         self.check(b, a)

Here is the call graph for this function:

Definition at line 3712 of file test_fixers.py.

03712 
03713     def test_ifilter_and_zip_longest(self):
03714         for name in "filterfalse", "zip_longest":
03715             b = "from itertools import i%s" % (name,)
03716             a = "from itertools import %s" % (name,)
03717             self.check(b, a)
03718 
03719             b = "from itertools import imap, i%s, foo" % (name,)
03720             a = "from itertools import %s, foo" % (name,)
03721             self.check(b, a)
03722 
03723             b = "from itertools import bar, i%s, foo" % (name,)
03724             a = "from itertools import bar, %s, foo" % (name,)
03725             self.check(b, a)

Here is the call graph for this function:

Definition at line 3692 of file test_fixers.py.

03692 
03693     def test_import_as(self):
03694         b = "from itertools import izip, bar as bang, imap"
03695         a = "from itertools import bar as bang"
03696         self.check(b, a)
03697 
03698         b = "from itertools import izip as _zip, imap, bar"
03699         a = "from itertools import bar"
03700         self.check(b, a)
03701 
03702         b = "from itertools import imap as _map"
03703         a = ""
03704         self.check(b, a)
03705 
03706         b = "from itertools import imap as _map, izip as _zip"
03707         a = ""
03708         self.check(b, a)
03709 
03710         s = "from itertools import bar as bang"
03711         self.unchanged(s)

Here is the call graph for this function:

Definition at line 3726 of file test_fixers.py.

03726 
03727     def test_import_star(self):
03728         s = "from itertools import *"
03729         self.unchanged(s)
03730 

Here is the call graph for this function:

Definition at line 3683 of file test_fixers.py.

03683 
03684     def test_none(self):
03685         b = "from itertools import imap, izip"
03686         a = ""
03687         self.check(b, a)
03688 
03689         b = "from itertools import izip"
03690         a = ""
03691         self.check(b, a)

Here is the call graph for this function:

Definition at line 3665 of file test_fixers.py.

03665 
03666     def test_reduced(self):
03667         b = "from itertools import imap, izip, foo"
03668         a = "from itertools import foo"
03669         self.check(b, a)
03670 
03671         b = "from itertools import bar, imap, izip, foo"
03672         a = "from itertools import bar, foo"
03673         self.check(b, a)
03674 
03675         b = "from itertools import chain, imap, izip"
03676         a = "from itertools import chain"
03677         self.check(b, a)

Here is the call graph for this function:

Definition at line 3731 of file test_fixers.py.

03731 
03732     def test_unchanged(self):
03733         s = "from itertools import foo"
03734         self.unchanged(s)
03735 

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 3663 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: