Back to index

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

List of all members.

Public Member Functions

def test_unchanged_1
def test_unchanged_2
def test_unchanged_3
def test_1
def test_2
def test_3
def test_semicolon
def test_keywords
def test_varargs
def test_multi_1
def test_multi_2
def test_docstring
def test_lambda_no_change
def test_lambda_parens_single_arg
def test_lambda_simple
def test_lambda_one_tuple
def test_lambda_simple_multi_use
def test_lambda_simple_reverse
def test_lambda_nested
def test_lambda_nested_multi_use
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 = "tuple_params"

Detailed Description

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

01944 
01945     def test_1(self):
01946         b = """
01947             def foo(((a, b), c)):
01948                 x = 5"""
01949 
01950         a = """
01951             def foo(xxx_todo_changeme):
01952                 ((a, b), c) = xxx_todo_changeme
01953                 x = 5"""
01954         self.check(b, a)

Here is the call graph for this function:

Definition at line 1955 of file test_fixers.py.

01955 
01956     def test_2(self):
01957         b = """
01958             def foo(((a, b), c), d):
01959                 x = 5"""
01960 
01961         a = """
01962             def foo(xxx_todo_changeme, d):
01963                 ((a, b), c) = xxx_todo_changeme
01964                 x = 5"""
01965         self.check(b, a)

Here is the call graph for this function:

Definition at line 1966 of file test_fixers.py.

01966 
01967     def test_3(self):
01968         b = """
01969             def foo(((a, b), c), d) -> e:
01970                 x = 5"""
01971 
01972         a = """
01973             def foo(xxx_todo_changeme, d) -> e:
01974                 ((a, b), c) = xxx_todo_changeme
01975                 x = 5"""
01976         self.check(b, a)

Here is the call graph for this function:

Definition at line 2031 of file test_fixers.py.

02031 
02032     def test_docstring(self):
02033         b = """
02034             def foo(((a, b), c), (d, e, f)) -> z:
02035                 "foo foo foo foo"
02036                 x = 5"""
02037 
02038         a = """
02039             def foo(xxx_todo_changeme, xxx_todo_changeme1) -> z:
02040                 "foo foo foo foo"
02041                 ((a, b), c) = xxx_todo_changeme
02042                 (d, e, f) = xxx_todo_changeme1
02043                 x = 5"""
02044         self.check(b, a)

Here is the call graph for this function:

Definition at line 1985 of file test_fixers.py.

01985 
01986     def test_keywords(self):
01987         b = """
01988             def foo(((a, b), c), d, e=5) -> z:
01989                 x = 5"""
01990 
01991         a = """
01992             def foo(xxx_todo_changeme, d, e=5) -> z:
01993                 ((a, b), c) = xxx_todo_changeme
01994                 x = 5"""
01995         self.check(b, a)

Here is the call graph for this function:

Definition at line 2102 of file test_fixers.py.

02102 
02103     def test_lambda_nested(self):
02104         b = """lambda (x, (y, z)): x + y + z"""
02105         a = """lambda x_y_z: x_y_z[0] + x_y_z[1][0] + x_y_z[1][1]"""
02106         self.check(b, a)
02107 
02108         b = """lambda (((x, (y, z)))): x + y + z"""
02109         a = """lambda x_y_z: x_y_z[0] + x_y_z[1][0] + x_y_z[1][1]"""
02110         self.check(b, a)

Here is the call graph for this function:

Definition at line 2111 of file test_fixers.py.

02111 
02112     def test_lambda_nested_multi_use(self):
02113         b = """lambda (x, (y, z)): x + y + f(y)"""
02114         a = """lambda x_y_z: x_y_z[0] + x_y_z[1][0] + f(x_y_z[1][0])"""
02115         self.check(b, a)

Here is the call graph for this function:

Definition at line 2045 of file test_fixers.py.

02045 
02046     def test_lambda_no_change(self):
02047         s = """lambda x: x + 5"""
02048         self.unchanged(s)

Here is the call graph for this function:

Definition at line 2083 of file test_fixers.py.

02083 
02084     def test_lambda_one_tuple(self):
02085         b = """lambda (x,): x + f(x)"""
02086         a = """lambda x1: x1[0] + f(x1[0])"""
02087         self.check(b, a)
02088 
02089         b = """lambda (((x,))): x + f(x)"""
02090         a = """lambda x1: x1[0] + f(x1[0])"""
02091         self.check(b, a)

Here is the call graph for this function:

Definition at line 2049 of file test_fixers.py.

02049 
02050     def test_lambda_parens_single_arg(self):
02051         b = """lambda (x): x + 5"""
02052         a = """lambda x: x + 5"""
02053         self.check(b, a)
02054 
02055         b = """lambda(x): x + 5"""
02056         a = """lambda x: x + 5"""
02057         self.check(b, a)
02058 
02059         b = """lambda ((((x)))): x + 5"""
02060         a = """lambda x: x + 5"""
02061         self.check(b, a)
02062 
02063         b = """lambda((((x)))): x + 5"""
02064         a = """lambda x: x + 5"""
02065         self.check(b, a)

Here is the call graph for this function:

Definition at line 2066 of file test_fixers.py.

02066 
02067     def test_lambda_simple(self):
02068         b = """lambda (x, y): x + f(y)"""
02069         a = """lambda x_y: x_y[0] + f(x_y[1])"""
02070         self.check(b, a)
02071 
02072         b = """lambda(x, y): x + f(y)"""
02073         a = """lambda x_y: x_y[0] + f(x_y[1])"""
02074         self.check(b, a)
02075 
02076         b = """lambda (((x, y))): x + f(y)"""
02077         a = """lambda x_y: x_y[0] + f(x_y[1])"""
02078         self.check(b, a)
02079 
02080         b = """lambda(((x, y))): x + f(y)"""
02081         a = """lambda x_y: x_y[0] + f(x_y[1])"""
02082         self.check(b, a)

Here is the call graph for this function:

Definition at line 2092 of file test_fixers.py.

02092 
02093     def test_lambda_simple_multi_use(self):
02094         b = """lambda (x, y): x + x + f(x) + x"""
02095         a = """lambda x_y: x_y[0] + x_y[0] + f(x_y[0]) + x_y[0]"""
02096         self.check(b, a)

Here is the call graph for this function:

Definition at line 2097 of file test_fixers.py.

02097 
02098     def test_lambda_simple_reverse(self):
02099         b = """lambda (x, y): y + x"""
02100         a = """lambda x_y: x_y[1] + x_y[0]"""
02101         self.check(b, a)

Here is the call graph for this function:

Definition at line 2007 of file test_fixers.py.

02007 
02008     def test_multi_1(self):
02009         b = """
02010             def foo(((a, b), c), (d, e, f)) -> z:
02011                 x = 5"""
02012 
02013         a = """
02014             def foo(xxx_todo_changeme, xxx_todo_changeme1) -> z:
02015                 ((a, b), c) = xxx_todo_changeme
02016                 (d, e, f) = xxx_todo_changeme1
02017                 x = 5"""
02018         self.check(b, a)

Here is the call graph for this function:

Definition at line 2019 of file test_fixers.py.

02019 
02020     def test_multi_2(self):
02021         b = """
02022             def foo(x, ((a, b), c), d, (e, f, g), y) -> z:
02023                 x = 5"""
02024 
02025         a = """
02026             def foo(x, xxx_todo_changeme, d, xxx_todo_changeme1, y) -> z:
02027                 ((a, b), c) = xxx_todo_changeme
02028                 (e, f, g) = xxx_todo_changeme1
02029                 x = 5"""
02030         self.check(b, a)

Here is the call graph for this function:

Definition at line 1977 of file test_fixers.py.

01977 
01978     def test_semicolon(self):
01979         b = """
01980             def foo(((a, b), c)): x = 5; y = 7"""
01981 
01982         a = """
01983             def foo(xxx_todo_changeme): ((a, b), c) = xxx_todo_changeme; x = 5; y = 7"""
01984         self.check(b, a)

Here is the call graph for this function:

Definition at line 1932 of file test_fixers.py.

01932 
01933     def test_unchanged_1(self):
01934         s = """def foo(): pass"""
01935         self.unchanged(s)

Here is the call graph for this function:

Definition at line 1936 of file test_fixers.py.

01936 
01937     def test_unchanged_2(self):
01938         s = """def foo(a, b, c): pass"""
01939         self.unchanged(s)

Here is the call graph for this function:

Definition at line 1940 of file test_fixers.py.

01940 
01941     def test_unchanged_3(self):
01942         s = """def foo(a=3, b=4, c=5): pass"""
01943         self.unchanged(s)

Here is the call graph for this function:

Definition at line 1996 of file test_fixers.py.

01996 
01997     def test_varargs(self):
01998         b = """
01999             def foo(((a, b), c), d, *vargs, **kwargs) -> z:
02000                 x = 5"""
02001 
02002         a = """
02003             def foo(xxx_todo_changeme, d, *vargs, **kwargs) -> z:
02004                 ((a, b), c) = xxx_todo_changeme
02005                 x = 5"""
02006         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 1930 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: