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

Function check_tokens

pytest/test_grammar.py:8–17  ·  view source on GitHub ↗
(tokens, opcode_set)

Source from the content-addressed store, hash-verified

6
7def test_grammar():
8 def check_tokens(tokens, opcode_set):
9 remain_tokens = set(tokens) - opcode_set
10 remain_tokens = set([re.sub(r"_\d+$", "", t) for t in remain_tokens])
11 remain_tokens = set([re.sub("_CONT$", "", t) for t in remain_tokens])
12 remain_tokens = set([re.sub("LOAD_CODE$", "", t) for t in remain_tokens])
13 remain_tokens = set(remain_tokens) - opcode_set
14 assert remain_tokens == set([]), "Remaining tokens %s\n====\n%s" % (
15 remain_tokens,
16 p.dump_grammar(),
17 )
18
19 p = get_python_parser(PYTHON_VERSION_TRIPLE, is_pypy=IS_PYPY)
20 (lhs, rhs, tokens, right_recursive, dup_rhs) = p.check_sets()

Callers 1

test_grammarFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected