示例#1
0
def validate_get_tokens_reentrant(*buffers):
    tokens = []
    buffer = Buffer('')
    for b in buffers:
        buffer = buffer + b
        tokens += list(get_tokens(buffer))
    tokens += list(get_tokens(buffer, False))
    unfinished = buffer.search()
    assert not unfinished
    assert len(tokens) == len(RAW_TOKENS)
    assert tokens == RAW_TOKENS
示例#2
0
def test_get_tokens_all():
    buf = Buffer(RAW_DATA)
    parser = get_tokens(buf, more_data=False)
    tokens = list(parser)
    assert len(tokens) == len(RAW_TOKENS)
    assert tokens == RAW_TOKENS