Back to index

python3.2  3.2.2
Public Member Functions
lib2to3.tests.test_fixers.ImportsFixerTests Class Reference
Inheritance diagram for lib2to3.tests.test_fixers.ImportsFixerTests:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def test_import_module
def test_import_from
def test_import_module_as
def test_import_from_as
def test_star
def test_import_module_usage

Detailed Description

Definition at line 1632 of file test_fixers.py.


Member Function Documentation

Definition at line 1644 of file test_fixers.py.

01644 
01645     def test_import_from(self):
01646         for old, new in self.modules.items():
01647             b = "from %s import foo" % old
01648             a = "from %s import foo" % new
01649             self.check(b, a)
01650 
01651             b = "from %s import foo, bar" % old
01652             a = "from %s import foo, bar" % new
01653             self.check(b, a)
01654 
01655             b = "from %s import (yes, no)" % old
01656             a = "from %s import (yes, no)" % new
01657             self.check(b, a)

Here is the call graph for this function:

Definition at line 1668 of file test_fixers.py.

01668 
01669     def test_import_from_as(self):
01670         for old, new in self.modules.items():
01671             b = "from %s import foo as bar" % old
01672             a = "from %s import foo as bar" % new
01673             self.check(b, a)

Here is the call graph for this function:

Definition at line 1634 of file test_fixers.py.

01634 
01635     def test_import_module(self):
01636         for old, new in self.modules.items():
01637             b = "import %s" % old
01638             a = "import %s" % new
01639             self.check(b, a)
01640 
01641             b = "import foo, %s, bar" % old
01642             a = "import foo, %s, bar" % new
01643             self.check(b, a)

Here is the call graph for this function:

Definition at line 1658 of file test_fixers.py.

01658 
01659     def test_import_module_as(self):
01660         for old, new in self.modules.items():
01661             b = "import %s as foo_bar" % old
01662             a = "import %s as foo_bar" % new
01663             self.check(b, a)
01664 
01665             b = "import %s as foo_bar" % old
01666             a = "import %s as foo_bar" % new
01667             self.check(b, a)

Here is the call graph for this function:

Definition at line 1680 of file test_fixers.py.

01680 
01681     def test_import_module_usage(self):
01682         for old, new in self.modules.items():
01683             b = """
01684                 import %s
01685                 foo(%s.bar)
01686                 """ % (old, old)
01687             a = """
01688                 import %s
01689                 foo(%s.bar)
01690                 """ % (new, new)
01691             self.check(b, a)
01692 
01693             b = """
01694                 from %s import x
01695                 %s = 23
01696                 """ % (old, old)
01697             a = """
01698                 from %s import x
01699                 %s = 23
01700                 """ % (new, old)
01701             self.check(b, a)
01702 
01703             s = """
01704                 def f():
01705                     %s.method()
01706                 """ % (old,)
01707             self.unchanged(s)
01708 
01709             # test nested usage
01710             b = """
01711                 import %s
01712                 %s.bar(%s.foo)
01713                 """ % (old, old, old)
01714             a = """
01715                 import %s
01716                 %s.bar(%s.foo)
01717                 """ % (new, new, new)
01718             self.check(b, a)
01719 
01720             b = """
01721                 import %s
01722                 x.%s
01723                 """ % (old, old)
01724             a = """
01725                 import %s
01726                 x.%s
01727                 """ % (new, old)
01728             self.check(b, a)
01729 

Here is the call graph for this function:

Definition at line 1674 of file test_fixers.py.

01674 
01675     def test_star(self):
01676         for old, new in self.modules.items():
01677             b = "from %s import *" % old
01678             a = "from %s import *" % new
01679             self.check(b, a)

Here is the call graph for this function:


The documentation for this class was generated from the following file: