Fix marshal bug in handling complex numbers

This commit is contained in:
rocky
2016-05-17 19:25:34 -04:00
parent 9462e33f48
commit a3dd61c981
4 changed files with 28 additions and 2 deletions

20
pytest/test_marsh.py Normal file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/env python
import os.path
from uncompyle6.load import load_module
def get_srcdir():
filename = os.path.normcase(os.path.dirname(os.path.abspath(__file__)))
return os.path.realpath(filename)
srcdir = get_srcdir()
def test_load_module():
"""Tests uncompile6.load.load_module"""
# We deliberately pick a bytecode that we aren't likely to be running against
mod_file = os.path.join(get_srcdir(), '..', 'test', 'bytecode_2.5',
'02_complex.pyc')
version, timestamp, magic_int, co = load_module(mod_file)
assert version == 2.5, "Should have picked up Python version properly"
assert co.co_consts == (5j, None), "Code should have a complex constant"