예제 #1
0
async def test_read_until_shared_boundary(chunk_size):
    source = chop_data(b'-boundary-like-' * 4 + b'--some junk--\n' +
                       b'\n' * 1024,
                       min_size=chunk_size,
                       max_size=chunk_size)
    stream = reader.BufferedReader(source, chunk_size)
    assert await stream.read_until(b'-boundary-like---') == (
        b'-boundary-like-' * 3)
    assert await stream.peek(17) == b'-boundary-like---'
예제 #2
0
def reader3():
    return reader.BufferedReader(async_iter(SOURCE3), chunk_size=2048)
예제 #3
0
def reader1():
    return reader.BufferedReader(async_iter(SOURCE1), chunk_size=8)
예제 #4
0
async def test_peek_at_eof():
    source = chop_data(b'Hello!')
    stream = reader.BufferedReader(source)
    assert await stream.peek(16) == b'Hello!'