Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Static Public Attributes
lib2to3.tests.test_fixers.Test_has_key Class Reference
Inheritance diagram for lib2to3.tests.test_fixers.Test_has_key:
Inheritance graph
[legend]
Collaboration diagram for lib2to3.tests.test_fixers.Test_has_key:
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_7
def test_8
def test_9
def test_10
def test_11
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 = "has_key"

Detailed Description

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

00101 
00102     def test_1(self):
00103         b = """x = d.has_key("x") or d.has_key("y")"""
00104         a = """x = "x" in d or "y" in d"""
00105         self.check(b, a)

Here is the call graph for this function:

Definition at line 146 of file test_fixers.py.

00146 
00147     def test_10(self):
00148         b = """if not a.has_key(b).__repr__(): pass"""
00149         a = """if not (b in a).__repr__(): pass"""
00150         self.check(b, a)

Here is the call graph for this function:

Definition at line 151 of file test_fixers.py.

00151 
00152     def test_11(self):
00153         b = """if not a.has_key(b) ** 2: pass"""
00154         a = """if not (b in a) ** 2: pass"""
00155         self.check(b, a)

Here is the call graph for this function:

Definition at line 106 of file test_fixers.py.

00106 
00107     def test_2(self):
00108         b = """x = a.b.c.d.has_key("x") ** 3"""
00109         a = """x = ("x" in a.b.c.d) ** 3"""
00110         self.check(b, a)

Here is the call graph for this function:

Definition at line 111 of file test_fixers.py.

00111 
00112     def test_3(self):
00113         b = """x = a.b.has_key(1 + 2).__repr__()"""
00114         a = """x = (1 + 2 in a.b).__repr__()"""
00115         self.check(b, a)

Here is the call graph for this function:

Definition at line 116 of file test_fixers.py.

00116 
00117     def test_4(self):
00118         b = """x = a.b.has_key(1 + 2).__repr__() ** -3 ** 4"""
00119         a = """x = (1 + 2 in a.b).__repr__() ** -3 ** 4"""
00120         self.check(b, a)

Here is the call graph for this function:

Definition at line 121 of file test_fixers.py.

00121 
00122     def test_5(self):
00123         b = """x = a.has_key(f or g)"""
00124         a = """x = (f or g) in a"""
00125         self.check(b, a)

Here is the call graph for this function:

Definition at line 126 of file test_fixers.py.

00126 
00127     def test_6(self):
00128         b = """x = a + b.has_key(c)"""
00129         a = """x = a + (c in b)"""
00130         self.check(b, a)

Here is the call graph for this function:

Definition at line 131 of file test_fixers.py.

00131 
00132     def test_7(self):
00133         b = """x = a.has_key(lambda: 12)"""
00134         a = """x = (lambda: 12) in a"""
00135         self.check(b, a)

Here is the call graph for this function:

Definition at line 136 of file test_fixers.py.

00136 
00137     def test_8(self):
00138         b = """x = a.has_key(a for a in b)"""
00139         a = """x = (a for a in b) in a"""
00140         self.check(b, a)

Here is the call graph for this function:

Definition at line 141 of file test_fixers.py.

00141 
00142     def test_9(self):
00143         b = """if not a.has_key(b): pass"""
00144         a = """if b not in a: pass"""
00145         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 99 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: