'Check that the provided spec parses to the provided token list.'

def check_lex(self, tokens, spec):

    spec = shlex.split(spec)
    lex_output = sp.SpecLexer().lex(spec)
    for (tok, spec_tok) in zip(tokens, lex_output):
        if ((tok.type == sp.ID) or (tok.type == sp.VAL)):
            assert (tok == spec_tok)
        else:
            assert (tok.type == spec_tok.type)
