Back to index

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

List of all members.

Public Member Functions

def test_basic
def test_prefix_preservation
def test_with_comments
def test_None_value
def test_tuple_value
def test_tuple_detection
def test_tuple_exc_1
def test_tuple_exc_2
def test_string_exc
def test_string_exc_val
def test_string_exc_val_tb
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 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 = "raise"

Detailed Description

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

00842 
00843     def test_basic(self):
00844         b = """raise Exception, 5"""
00845         a = """raise Exception(5)"""
00846         self.check(b, a)

Here is the call graph for this function:

Definition at line 871 of file test_fixers.py.

00871 
00872     def test_None_value(self):
00873         b = """raise Exception(5), None, tb"""
00874         a = """raise Exception(5).with_traceback(tb)"""
00875         self.check(b, a)

Here is the call graph for this function:

Definition at line 847 of file test_fixers.py.

00847 
00848     def test_prefix_preservation(self):
00849         b = """raise Exception,5"""
00850         a = """raise Exception(5)"""
00851         self.check(b, a)
00852 
00853         b = """raise   Exception,    5"""
00854         a = """raise   Exception(5)"""
00855         self.check(b, a)

Here is the call graph for this function:

Definition at line 898 of file test_fixers.py.

00898 
00899     def test_string_exc(self):
00900         s = """raise 'foo'"""
00901         self.warns_unchanged(s, "Python 3 does not support string exceptions")

Here is the call graph for this function:

Definition at line 902 of file test_fixers.py.

00902 
00903     def test_string_exc_val(self):
00904         s = """raise "foo", 5"""
00905         self.warns_unchanged(s, "Python 3 does not support string exceptions")

Here is the call graph for this function:

Definition at line 906 of file test_fixers.py.

00906 
00907     def test_string_exc_val_tb(self):
00908         s = """raise "foo", 5, 6"""
00909         self.warns_unchanged(s, "Python 3 does not support string exceptions")

Here is the call graph for this function:

Definition at line 912 of file test_fixers.py.

00912 
00913     def test_tb_1(self):
00914         b = """def foo():
00915                     raise Exception, 5, 6"""
00916         a = """def foo():
00917                     raise Exception(5).with_traceback(6)"""
00918         self.check(b, a)

Here is the call graph for this function:

Definition at line 919 of file test_fixers.py.

00919 
00920     def test_tb_2(self):
00921         b = """def foo():
00922                     a = 5
00923                     raise Exception, 5, 6
00924                     b = 6"""
00925         a = """def foo():
00926                     a = 5
00927                     raise Exception(5).with_traceback(6)
00928                     b = 6"""
00929         self.check(b, a)

Here is the call graph for this function:

Definition at line 930 of file test_fixers.py.

00930 
00931     def test_tb_3(self):
00932         b = """def foo():
00933                     raise Exception,5,6"""
00934         a = """def foo():
00935                     raise Exception(5).with_traceback(6)"""
00936         self.check(b, a)

Here is the call graph for this function:

Definition at line 937 of file test_fixers.py.

00937 
00938     def test_tb_4(self):
00939         b = """def foo():
00940                     a = 5
00941                     raise Exception,5,6
00942                     b = 6"""
00943         a = """def foo():
00944                     a = 5
00945                     raise Exception(5).with_traceback(6)
00946                     b = 6"""
00947         self.check(b, a)

Here is the call graph for this function:

Definition at line 948 of file test_fixers.py.

00948 
00949     def test_tb_5(self):
00950         b = """def foo():
00951                     raise Exception, (5, 6, 7), 6"""
00952         a = """def foo():
00953                     raise Exception(5, 6, 7).with_traceback(6)"""
00954         self.check(b, a)

Here is the call graph for this function:

Definition at line 955 of file test_fixers.py.

00955 
00956     def test_tb_6(self):
00957         b = """def foo():
00958                     a = 5
00959                     raise Exception, (5, 6, 7), 6
00960                     b = 6"""
00961         a = """def foo():
00962                     a = 5
00963                     raise Exception(5, 6, 7).with_traceback(6)
00964                     b = 6"""
00965         self.check(b, a)

Here is the call graph for this function:

Definition at line 881 of file test_fixers.py.

00881 
00882     def test_tuple_detection(self):
00883         b = """raise E, (5, 6) % (a, b)"""
00884         a = """raise E((5, 6) % (a, b))"""
00885         self.check(b, a)

Here is the call graph for this function:

Definition at line 886 of file test_fixers.py.

00886 
00887     def test_tuple_exc_1(self):
00888         b = """raise (((E1, E2), E3), E4), V"""
00889         a = """raise E1(V)"""
00890         self.check(b, a)

Here is the call graph for this function:

Definition at line 891 of file test_fixers.py.

00891 
00892     def test_tuple_exc_2(self):
00893         b = """raise (E1, (E2, E3), E4), V"""
00894         a = """raise E1(V)"""
00895         self.check(b, a)

Here is the call graph for this function:

Definition at line 876 of file test_fixers.py.

00876 
00877     def test_tuple_value(self):
00878         b = """raise Exception, (5, 6, 7)"""
00879         a = """raise Exception(5, 6, 7)"""
00880         self.check(b, a)

Here is the call graph for this function:

Definition at line 856 of file test_fixers.py.

00856 
00857     def test_with_comments(self):
00858         b = """raise Exception, 5 # foo"""
00859         a = """raise Exception(5) # foo"""
00860         self.check(b, a)
00861 
00862         b = """raise E, (5, 6) % (a, b) # foo"""
00863         a = """raise E((5, 6) % (a, b)) # foo"""
00864         self.check(b, a)
00865 
00866         b = """def foo():
00867                     raise Exception, 5, 6 # foo"""
00868         a = """def foo():
00869                     raise Exception(5).with_traceback(6) # foo"""
00870         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 840 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: