()
| 2 | |
| 3 | |
| 4 | def 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 | |
| 23 | if __name__ == "__main__": |
no test coverage detected