Back to index

python3.2  3.2.2
Public Member Functions
importlib.test.import_.test_fromlist.ReturnValue Class Reference

List of all members.

Public Member Functions

def test_return_from_import
def test_return_from_from_import

Detailed Description

The use of fromlist influences what import returns.

If direct ``import ...`` statement is used, the root module or package is
returned [import return]. But if fromlist is set, then the specified module
is actually returned (whether it is a relative import or not)
[from return].

Definition at line 6 of file

Member Function Documentation

Definition at line 24 of file

00025     def test_return_from_from_import(self):
00026         # [from return]
00027         with util.mock_modules('pkg.__init__', 'pkg.module')as importer:
00028             with util.import_state(meta_path=[importer]):
00029                 module = import_util.import_('pkg.module', fromlist=['attr'])
00030                 self.assertEqual(module.__name__, 'pkg.module')

Here is the call graph for this function:

Definition at line 17 of file

00018     def test_return_from_import(self):
00019         # [import return]
00020         with util.mock_modules('pkg.__init__', 'pkg.module') as importer:
00021             with util.import_state(meta_path=[importer]):
00022                 module = import_util.import_('pkg.module')
00023                 self.assertEqual(module.__name__, 'pkg')

Here is the call graph for this function:

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