MCPcopy Index your code
hub / github.com/rocky/python-uncompyle6 / test_token

Function test_token

pytest/test_token.py:4–20  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2
3
4def test_token():
5 # Test token formatting of: LOAD_CONST None
6 t = Token("LOAD_CONST", offset=0, attr=None, pattr=None, has_arg=True)
7 expect = "0 LOAD_CONST None"
8 # print(t.format())
9 assert t
10 assert t.format().strip() == expect.strip()
11
12 # Make sure equality testing of tokens ignores offset
13 t2 = Token("LOAD_CONST", offset=2, attr=None, pattr=None, has_arg=True)
14 assert t2 == t
15
16 # Make sure formatting of: LOAD_CONST False. We assume False is the 0th index
17 # of co_consts.
18 t = Token("LOAD_CONST", offset=1, attr=False, pattr=False, has_arg=True)
19 expect = "1 LOAD_CONST False"
20 assert t.format().strip() == expect.strip()
21
22
23if __name__ == "__main__":

Callers 1

test_token.pyFile · 0.85

Calls 2

formatMethod · 0.95
TokenClass · 0.90

Tested by

no test coverage detected