예제 #1
0
def test_simple_read():
    buff = ReadBuffer(b'abcd')

    assert buff.take(1) == b'a'
    assert buff.take(2) == b'bc'

    with pytest.raises(EndOfInputError):
        buff.take(2)

    assert buff.take(1) == b'd'
예제 #2
0
def test_empty_read_buffer():
    buff = ReadBuffer(b'')
    assert buff.take(0) == b''

    with pytest.raises(EndOfInputError):
        buff.take(1)