Created
March 9, 2017 21:45
-
-
Save x746e/3320899785157181fea34613abb40e97 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ksp@ksp0 (venv-xdis-python3)~/src/python-xdis/pytest | |
% pytest ? master | |
========================================================================== test session starts ========================================================================== | |
platform linux -- Python 3.4.3, pytest-3.0.6, py-1.4.32, pluggy-0.4.0 | |
rootdir: /usr/local/google/home/ksp/src/python-xdis, inifile: | |
collected 20 items | |
test_bytecode.py . | |
test_disasm.py ... | |
test_load.py . | |
test_std.py ....F.FF...F... | |
=============================================================================== FAILURES ================================================================================ | |
__________________________________________________________________________ test_bytecode_info ___________________________________________________________________________ | |
bytecode_fixture = Bytecode('a = 10') | |
def test_bytecode_info(bytecode_fixture): | |
> assert bytecode_fixture.info() == EXPECTED_CODE_INFO | |
E assert '# Method Nam...s:\n# 0: a' == '# Method Name...s:\n# 0: a' | |
E Skipping 100 identical leading characters in diff, use -v to show | |
E - guments: 0 | |
E - # Number of locals: 0 | |
E + guments: 0# Number of locals: 0 | |
E ? ++++++++++ | |
E # Stack size: 1 | |
E # Flags: 0x00000040 (NOFREE) | |
E # Constants: | |
E # 0: 10 | |
E # 1: None | |
E # Names: | |
E # 0: a | |
test_std.py:87: AssertionError | |
____________________________________________________________________________ test_code_info _____________________________________________________________________________ | |
def test_code_info(): | |
> assert dis.code_info(TEST_SOURCE_CODE) == EXPECTED_CODE_INFO | |
E assert '# Method Nam...s:\n# 0: a' == '# Method Name...s:\n# 0: a' | |
E Skipping 100 identical leading characters in diff, use -v to show | |
E - guments: 0 | |
E - # Number of locals: 0 | |
E + guments: 0# Number of locals: 0 | |
E ? ++++++++++ | |
E # Stack size: 1 | |
E # Flags: 0x00000040 (NOFREE) | |
E # Constants: | |
E # 0: 10 | |
E # 1: None | |
E # Names: | |
E # 0: a | |
test_std.py:95: AssertionError | |
____________________________________________________________________________ test_show_code _____________________________________________________________________________ | |
stream_fixture = <_io.StringIO object at 0x7ff757dc1f78> | |
def test_show_code(stream_fixture): | |
dis.show_code(TEST_SOURCE_CODE, file=stream_fixture) | |
actual = stream_fixture.getvalue() | |
> assert actual == EXPECTED_CODE_INFO + '\n' | |
E assert '# Method Nam...\n# 0: a\n' == '# Method Name...\n# 0: a\n' | |
E Skipping 100 identical leading characters in diff, use -v to show | |
E - guments: 0 | |
E - # Number of locals: 0 | |
E + guments: 0# Number of locals: 0 | |
E ? ++++++++++ | |
E # Stack size: 1 | |
E # Flags: 0x00000040 (NOFREE) | |
E # Constants: | |
E # 0: 10 | |
E # 1: None | |
E # Names: | |
E # 0: a | |
test_std.py:101: AssertionError | |
___________________________________________________________________________ test_disassemble ____________________________________________________________________________ | |
stream_fixture = <_io.StringIO object at 0x7ff757dcca68> | |
def test_disassemble(stream_fixture): | |
dis.disassemble(TEST_CODE, file=stream_fixture) | |
actual = stream_fixture.getvalue() | |
expected = EXPECTED_CODE_INFO + '\n' + EXPECTED_DIS + '\n' | |
> assert actual == expected | |
E assert '# Method Nam...URN_VALUE\n\n' == '# Method Name...URN_VALUE\n\n' | |
E Skipping 100 identical leading characters in diff, use -v to show | |
E - guments: 0 | |
E - # Number of locals: 0 | |
E + guments: 0# Number of locals: 0 | |
E ? ++++++++++ | |
E # Stack size: 1 | |
E # Flags: 0x00000040 (NOFREE) | |
E # Constants: | |
E # 0: 10 | |
E # 1: None | |
E # Names: | |
E # 0: a | |
E 1 0 LOAD_CONST 0 (10) | |
E 3 STORE_NAME 0 (a) | |
E 6 LOAD_CONST 1 (None) | |
E 9 RETURN_VALUE | |
test_std.py:125: AssertionError | |
================================================================== 4 failed, 16 passed in 0.07 seconds ================================================================== |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment