Back to index

python3.2  3.2.2
Public Member Functions
test.test_frozen.FrozenTests Class Reference

List of all members.

Public Member Functions

def test_frozen

Detailed Description

Definition at line 7 of file test_frozen.py.


Member Function Documentation

Definition at line 8 of file test_frozen.py.

00008 
00009     def test_frozen(self):
00010         with captured_stdout() as stdout:
00011             try:
00012                 import __hello__
00013             except ImportError as x:
00014                 self.fail("import __hello__ failed:" + str(x))
00015             self.assertEqual(__hello__.initialized, True)
00016             self.assertEqual(len(dir(__hello__)), 7, dir(__hello__))
00017             self.assertEqual(stdout.getvalue(), 'Hello world!\n')
00018 
00019         with captured_stdout() as stdout:
00020             try:
00021                 import __phello__
00022             except ImportError as x:
00023                 self.fail("import __phello__ failed:" + str(x))
00024             self.assertEqual(__phello__.initialized, True)
00025             if not "__phello__.spam" in sys.modules:
00026                 self.assertEqual(len(dir(__phello__)), 8, dir(__phello__))
00027             else:
00028                 self.assertEqual(len(dir(__phello__)), 9, dir(__phello__))
00029             self.assertEqual(__phello__.__path__, [__phello__.__name__])
00030             self.assertEqual(stdout.getvalue(), 'Hello world!\n')
00031 
00032         with captured_stdout() as stdout:
00033             try:
00034                 import __phello__.spam
00035             except ImportError as x:
00036                 self.fail("import __phello__.spam failed:" + str(x))
00037             self.assertEqual(__phello__.spam.initialized, True)
00038             self.assertEqual(len(dir(__phello__.spam)), 7)
00039             self.assertEqual(len(dir(__phello__)), 9)
00040             self.assertEqual(stdout.getvalue(), 'Hello world!\n')
00041 
00042         try:
00043             import __phello__.foo
00044         except ImportError:
00045             pass
00046         else:
00047             self.fail("import __phello__.foo should have failed")
00048 
00049             try:
00050                 import __phello__.foo
00051             except ImportError:
00052                 pass
00053             else:
00054                 self.fail("import __phello__.foo should have failed")
00055 
00056         del sys.modules['__hello__']
00057         del sys.modules['__phello__']
00058         del sys.modules['__phello__.spam']

Here is the call graph for this function:


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