You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Bugs introduced in last commit
This commit is contained in:
@@ -1,14 +1,13 @@
|
|||||||
from uncompyle6 import PYTHON_VERSION
|
|
||||||
from uncompyle6.scanners.tok import Token
|
from uncompyle6.scanners.tok import Token
|
||||||
|
|
||||||
|
|
||||||
def test_token():
|
def test_token():
|
||||||
# Test token formatting of: LOAD_CONST None
|
# Test token formatting of: LOAD_CONST None
|
||||||
t = Token("LOAD_CONST", offset=0, attr=None, pattr=None, has_arg=True)
|
t = Token("LOAD_CONST", offset=0, attr=None, pattr=None, has_arg=True)
|
||||||
expect = " 0 LOAD_CONST None"
|
expect = "0 LOAD_CONST None"
|
||||||
# print(t.format())
|
# print(t.format())
|
||||||
assert t
|
assert t
|
||||||
assert t.format() == expect
|
assert t.format().strip() == expect.strip()
|
||||||
|
|
||||||
# Make sure equality testing of tokens ignores offset
|
# Make sure equality testing of tokens ignores offset
|
||||||
t2 = Token("LOAD_CONST", offset=2, attr=None, pattr=None, has_arg=True)
|
t2 = Token("LOAD_CONST", offset=2, attr=None, pattr=None, has_arg=True)
|
||||||
@@ -17,8 +16,8 @@ def test_token():
|
|||||||
# Make sure formatting of: LOAD_CONST False. We assume False is the 0th index
|
# Make sure formatting of: LOAD_CONST False. We assume False is the 0th index
|
||||||
# of co_consts.
|
# of co_consts.
|
||||||
t = Token("LOAD_CONST", offset=1, attr=False, pattr=False, has_arg=True)
|
t = Token("LOAD_CONST", offset=1, attr=False, pattr=False, has_arg=True)
|
||||||
expect = " 1 LOAD_CONST False"
|
expect = "1 LOAD_CONST False"
|
||||||
assert t.format() == expect
|
assert t.format().strip() == expect.strip()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
19
pytest/testdata/ifelse-2.7.right
vendored
19
pytest/testdata/ifelse-2.7.right
vendored
@@ -1,15 +1,12 @@
|
|||||||
# Python 2.7
|
# Python 2.7
|
||||||
# Embedded file name: simple_source/branching/05_ifelse.py
|
# Embedded file name: simple_source/branching/05_if.py
|
||||||
|
|
||||||
L. 3 0 LOAD_NAME 0 'True'
|
6 0 LOAD_NAME 0 'True'
|
||||||
3 POP_JUMP_IF_FALSE 15 'to 15'
|
3 POP_JUMP_IF_FALSE 15 'to 15'
|
||||||
|
|
||||||
L. 4 6 LOAD_CONST 1
|
7 6 LOAD_NAME 1 'False'
|
||||||
9 STORE_NAME 1 'b'
|
9 STORE_NAME 2 'b'
|
||||||
12 JUMP_FORWARD 6 'to 21'
|
12 JUMP_FORWARD 0 'to 15'
|
||||||
|
15_0 COME_FROM 12 '12'
|
||||||
L. 6 15 LOAD_CONST 2
|
15 LOAD_CONST None
|
||||||
18 STORE_NAME 2 'd'
|
18 RETURN_VALUE
|
||||||
21_0 COME_FROM 12 '12'
|
|
||||||
21 LOAD_CONST None
|
|
||||||
24 RETURN_VALUE
|
|
||||||
|
@@ -539,7 +539,7 @@ class Scanner3(Scanner):
|
|||||||
|
|
||||||
if show_asm in ("both", "after"):
|
if show_asm in ("both", "after"):
|
||||||
for t in tokens:
|
for t in tokens:
|
||||||
print(t.format(line_prefix=))
|
print(t.format(line_prefix=""))
|
||||||
print()
|
print()
|
||||||
return tokens, customize
|
return tokens, customize
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user