Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Private Member Functions
lib2to3.tests.test_fixers.FixerTestCase Class Reference

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

List of all members.

Public Member Functions

def setUp
def check
def warns
def warns_unchanged
def unchanged
def assert_runs_after

Public Attributes


Private Member Functions

def _check

Detailed Description

Definition at line 14 of file

Member Function Documentation

def lib2to3.tests.test_fixers.FixerTestCase._check (   self,
) [private]

Definition at line 29 of file

00030     def _check(self, before, after):
00031         before = support.reformat(before)
00032         after = support.reformat(after)
00033         tree = self.refactor.refactor_string(before, self.filename)
00034         self.assertEqual(after, str(tree))
00035         return tree

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 56 of file

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"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,
  ignore_warnings = False 

Definition at line 36 of file

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 

Definition at line 18 of file

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

def lib2to3.tests.test_fixers.FixerTestCase.unchanged (   self,
  ignore_warnings = False 

Definition at line 51 of file

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,
  unchanged = False 

Definition at line 42 of file

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,

Definition at line 48 of file

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

Definition at line 22 of file

Definition at line 21 of file

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