Back to index

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

List of all members.

Public Member Functions

def test_1
def test_2
def test_3
def test_4
def test_5
def test_6
def test_complex_1
def test_complex_2
def test_complex_3
def test_dotted_name
def test_subscript
def test_call
def test_extreme
def test_weird_comments
def test_unchanged_1
def test_unchanged_2
def test_unchanged_3
def test_unchanged_4
def test_unchanged_5
def test_unchanged_6
def test_unchanged_7
def test_unchanged_8
def test_unchanged_9
def test_space_1
def test_space_2
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 = "apply"

Detailed Description

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

00159 
00160     def test_1(self):
00161         b = """x = apply(f, g + h)"""
00162         a = """x = f(*g + h)"""
00163         self.check(b, a)

Here is the call graph for this function:

Definition at line 164 of file test_fixers.py.

00164 
00165     def test_2(self):
00166         b = """y = apply(f, g, h)"""
00167         a = """y = f(*g, **h)"""
00168         self.check(b, a)

Here is the call graph for this function:

Definition at line 169 of file test_fixers.py.

00169 
00170     def test_3(self):
00171         b = """z = apply(fs[0], g or h, h or g)"""
00172         a = """z = fs[0](*g or h, **h or g)"""
00173         self.check(b, a)

Here is the call graph for this function:

Definition at line 174 of file test_fixers.py.

00174 
00175     def test_4(self):
00176         b = """apply(f, (x, y) + t)"""
00177         a = """f(*(x, y) + t)"""
00178         self.check(b, a)

Here is the call graph for this function:

Definition at line 179 of file test_fixers.py.

00179 
00180     def test_5(self):
00181         b = """apply(f, args,)"""
00182         a = """f(*args)"""
00183         self.check(b, a)

Here is the call graph for this function:

Definition at line 184 of file test_fixers.py.

00184 
00185     def test_6(self):
00186         b = """apply(f, args, kwds,)"""
00187         a = """f(*args, **kwds)"""
00188         self.check(b, a)

Here is the call graph for this function:

Definition at line 218 of file test_fixers.py.

00218 
00219     def test_call(self):
00220         b = """x = apply(f(), args)"""
00221         a = """x = f()(*args)"""
00222         self.check(b, a)

Here is the call graph for this function:

Definition at line 191 of file test_fixers.py.

00191 
00192     def test_complex_1(self):
00193         b = """x = apply(f+g, args)"""
00194         a = """x = (f+g)(*args)"""
00195         self.check(b, a)

Here is the call graph for this function:

Definition at line 196 of file test_fixers.py.

00196 
00197     def test_complex_2(self):
00198         b = """x = apply(f*g, args)"""
00199         a = """x = (f*g)(*args)"""
00200         self.check(b, a)

Here is the call graph for this function:

Definition at line 201 of file test_fixers.py.

00201 
00202     def test_complex_3(self):
00203         b = """x = apply(f**g, args)"""
00204         a = """x = (f**g)(*args)"""
00205         self.check(b, a)

Here is the call graph for this function:

Definition at line 208 of file test_fixers.py.

00208 
00209     def test_dotted_name(self):
00210         b = """x = apply(f.g, args)"""
00211         a = """x = f.g(*args)"""
00212         self.check(b, a)

Here is the call graph for this function:

Definition at line 224 of file test_fixers.py.

00224 
00225     def test_extreme(self):
00226         b = """x = apply(a.b.c.d.e.f, args, kwds)"""
00227         a = """x = a.b.c.d.e.f(*args, **kwds)"""
00228         self.check(b, a)

Here is the call graph for this function:

Definition at line 275 of file test_fixers.py.

00275 
00276     def test_space_1(self):
00277         a = """apply(  f,  args,   kwds)"""
00278         b = """f(*args, **kwds)"""
00279         self.check(a, b)

Here is the call graph for this function:

Definition at line 280 of file test_fixers.py.

00280 
00281     def test_space_2(self):
00282         a = """apply(  f  ,args,kwds   )"""
00283         b = """f(*args, **kwds)"""
00284         self.check(a, b)

Here is the call graph for this function:

Definition at line 213 of file test_fixers.py.

00213 
00214     def test_subscript(self):
00215         b = """x = apply(f[x], args)"""
00216         a = """x = f[x](*args)"""
00217         self.check(b, a)

Here is the call graph for this function:

Definition at line 239 of file test_fixers.py.

00239 
00240     def test_unchanged_1(self):
00241         s = """apply()"""
00242         self.unchanged(s)

Here is the call graph for this function:

Definition at line 243 of file test_fixers.py.

00243 
00244     def test_unchanged_2(self):
00245         s = """apply(f)"""
00246         self.unchanged(s)

Here is the call graph for this function:

Definition at line 247 of file test_fixers.py.

00247 
00248     def test_unchanged_3(self):
00249         s = """apply(f,)"""
00250         self.unchanged(s)

Here is the call graph for this function:

Definition at line 251 of file test_fixers.py.

00251 
00252     def test_unchanged_4(self):
00253         s = """apply(f, args, kwds, extras)"""
00254         self.unchanged(s)

Here is the call graph for this function:

Definition at line 255 of file test_fixers.py.

00255 
00256     def test_unchanged_5(self):
00257         s = """apply(f, *args, **kwds)"""
00258         self.unchanged(s)

Here is the call graph for this function:

Definition at line 259 of file test_fixers.py.

00259 
00260     def test_unchanged_6(self):
00261         s = """apply(f, *args)"""
00262         self.unchanged(s)

Here is the call graph for this function:

Definition at line 263 of file test_fixers.py.

00263 
00264     def test_unchanged_7(self):
00265         s = """apply(func=f, args=args, kwds=kwds)"""
00266         self.unchanged(s)

Here is the call graph for this function:

Definition at line 267 of file test_fixers.py.

00267 
00268     def test_unchanged_8(self):
00269         s = """apply(f, args=args, kwds=kwds)"""
00270         self.unchanged(s)

Here is the call graph for this function:

Definition at line 271 of file test_fixers.py.

00271 
00272     def test_unchanged_9(self):
00273         s = """apply(f, args, kwds=kwds)"""
00274         self.unchanged(s)

Here is the call graph for this function:

Definition at line 230 of file test_fixers.py.

00230 
00231     def test_weird_comments(self):
00232         b = """apply(   # foo
00233           f, # bar
00234           args)"""
00235         a = """f(*args)"""
00236         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 157 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: