Back to index

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

List of all members.

Public Member Functions

def test_1
def test_2
def test_3
def test_4
def test_warn_1
def test_warn_2
def test_warn_3
def test_untouched_1
def test_untouched_2
def test_untouched_3
def test_tb_1
def test_tb_2
def test_tb_3
def test_tb_4
def test_tb_5
def test_tb_6
def test_tb_7
def test_tb_8
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 = "throw"

Detailed Description

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

00969 
00970     def test_1(self):
00971         b = """g.throw(Exception, 5)"""
00972         a = """g.throw(Exception(5))"""
00973         self.check(b, a)

Here is the call graph for this function:

Definition at line 974 of file test_fixers.py.

00974 
00975     def test_2(self):
00976         b = """g.throw(Exception,5)"""
00977         a = """g.throw(Exception(5))"""
00978         self.check(b, a)

Here is the call graph for this function:

Definition at line 979 of file test_fixers.py.

00979 
00980     def test_3(self):
00981         b = """g.throw(Exception, (5, 6, 7))"""
00982         a = """g.throw(Exception(5, 6, 7))"""
00983         self.check(b, a)

Here is the call graph for this function:

Definition at line 984 of file test_fixers.py.

00984 
00985     def test_4(self):
00986         b = """5 + g.throw(Exception, 5)"""
00987         a = """5 + g.throw(Exception(5))"""
00988         self.check(b, a)

Here is the call graph for this function:

Definition at line 1019 of file test_fixers.py.

01019 
01020     def test_tb_1(self):
01021         b = """def foo():
01022                     g.throw(Exception, 5, 6)"""
01023         a = """def foo():
01024                     g.throw(Exception(5).with_traceback(6))"""
01025         self.check(b, a)

Here is the call graph for this function:

Definition at line 1026 of file test_fixers.py.

01026 
01027     def test_tb_2(self):
01028         b = """def foo():
01029                     a = 5
01030                     g.throw(Exception, 5, 6)
01031                     b = 6"""
01032         a = """def foo():
01033                     a = 5
01034                     g.throw(Exception(5).with_traceback(6))
01035                     b = 6"""
01036         self.check(b, a)

Here is the call graph for this function:

Definition at line 1037 of file test_fixers.py.

01037 
01038     def test_tb_3(self):
01039         b = """def foo():
01040                     g.throw(Exception,5,6)"""
01041         a = """def foo():
01042                     g.throw(Exception(5).with_traceback(6))"""
01043         self.check(b, a)

Here is the call graph for this function:

Definition at line 1044 of file test_fixers.py.

01044 
01045     def test_tb_4(self):
01046         b = """def foo():
01047                     a = 5
01048                     g.throw(Exception,5,6)
01049                     b = 6"""
01050         a = """def foo():
01051                     a = 5
01052                     g.throw(Exception(5).with_traceback(6))
01053                     b = 6"""
01054         self.check(b, a)

Here is the call graph for this function:

Definition at line 1055 of file test_fixers.py.

01055 
01056     def test_tb_5(self):
01057         b = """def foo():
01058                     g.throw(Exception, (5, 6, 7), 6)"""
01059         a = """def foo():
01060                     g.throw(Exception(5, 6, 7).with_traceback(6))"""
01061         self.check(b, a)

Here is the call graph for this function:

Definition at line 1062 of file test_fixers.py.

01062 
01063     def test_tb_6(self):
01064         b = """def foo():
01065                     a = 5
01066                     g.throw(Exception, (5, 6, 7), 6)
01067                     b = 6"""
01068         a = """def foo():
01069                     a = 5
01070                     g.throw(Exception(5, 6, 7).with_traceback(6))
01071                     b = 6"""
01072         self.check(b, a)

Here is the call graph for this function:

Definition at line 1073 of file test_fixers.py.

01073 
01074     def test_tb_7(self):
01075         b = """def foo():
01076                     a + g.throw(Exception, 5, 6)"""
01077         a = """def foo():
01078                     a + g.throw(Exception(5).with_traceback(6))"""
01079         self.check(b, a)

Here is the call graph for this function:

Definition at line 1080 of file test_fixers.py.

01080 
01081     def test_tb_8(self):
01082         b = """def foo():
01083                     a = 5
01084                     a + g.throw(Exception, 5, 6)
01085                     b = 6"""
01086         a = """def foo():
01087                     a = 5
01088                     a + g.throw(Exception(5).with_traceback(6))
01089                     b = 6"""
01090         self.check(b, a)

Here is the call graph for this function:

Definition at line 1005 of file test_fixers.py.

01005 
01006     def test_untouched_1(self):
01007         s = """g.throw(Exception)"""
01008         self.unchanged(s)

Here is the call graph for this function:

Definition at line 1009 of file test_fixers.py.

01009 
01010     def test_untouched_2(self):
01011         s = """g.throw(Exception(5, 6))"""
01012         self.unchanged(s)

Here is the call graph for this function:

Definition at line 1013 of file test_fixers.py.

01013 
01014     def test_untouched_3(self):
01015         s = """5 + g.throw(Exception(5, 6))"""
01016         self.unchanged(s)

Here is the call graph for this function:

Definition at line 991 of file test_fixers.py.

00991 
00992     def test_warn_1(self):
00993         s = """g.throw("foo")"""
00994         self.warns_unchanged(s, "Python 3 does not support string exceptions")

Here is the call graph for this function:

Definition at line 995 of file test_fixers.py.

00995 
00996     def test_warn_2(self):
00997         s = """g.throw("foo", 5)"""
00998         self.warns_unchanged(s, "Python 3 does not support string exceptions")

Here is the call graph for this function:

Definition at line 999 of file test_fixers.py.

00999 
01000     def test_warn_3(self):
01001         s = """g.throw("foo", 5, 6)"""
01002         self.warns_unchanged(s, "Python 3 does not support string exceptions")

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