Back to index

python3.2  3.2.2
Public Member Functions
importlib.test.source.test_abc_loader.BadBytecodeFailureTests Class Reference

List of all members.

Public Member Functions

def test_bad_magic
def test_no_bytecode
def test_bad_bytecode

Detailed Description

Test import failures when there is no source and parts of the bytecode
is bad.

Definition at line 459 of file test_abc_loader.py.


Member Function Documentation

Definition at line 483 of file test_abc_loader.py.

00483 
00484     def test_bad_bytecode(self):
00485         # Malformed code object bytecode should lead to a ValueError.
00486         name = 'mod'
00487         bc = {name: {'path': os.path.join('path', 'to', 'mod'), 'bc': b'1234'}}
00488         mock = PyPycLoaderMock({name: None}, bc)
00489         with util.uncache(name), self.assertRaises(ValueError):
00490             mock.load_module(name)
00491 

Here is the call graph for this function:

Definition at line 464 of file test_abc_loader.py.

00464 
00465     def test_bad_magic(self):
00466         # A bad magic number should lead to an ImportError.
00467         name = 'mod'
00468         bad_magic = b'\x00\x00\x00\x00'
00469         bc = {name:
00470                 {'path': os.path.join('path', 'to', 'mod'),
00471                  'magic': bad_magic}}
00472         mock = PyPycLoaderMock({name: None}, bc)
00473         with util.uncache(name), self.assertRaises(ImportError):
00474             mock.load_module(name)

Here is the call graph for this function:

Definition at line 475 of file test_abc_loader.py.

00475 
00476     def test_no_bytecode(self):
00477         # Missing code object bytecode should lead to an EOFError.
00478         name = 'mod'
00479         bc = {name: {'path': os.path.join('path', 'to', 'mod'), 'bc': b''}}
00480         mock = PyPycLoaderMock({name: None}, bc)
00481         with util.uncache(name), self.assertRaises(EOFError):
00482             mock.load_module(name)

Here is the call graph for this function:


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