def test_peek(self): buffer = ByteBuffer() buffer.write(b"abcdefghi") assert buffer.peek(slice(0, 1)) == b"a" assert buffer.peek(slice(3, 6)) == b"def" assert buffer.peek(slice(-2, -1)) == b"h" assert buffer.read() == b"abcdefghi"
def test_read_all(self): buffer = ByteBuffer() buffer.write(b"abcdefghi") assert buffer.read() == b"abcdefghi" assert buffer.read() == b""
def test_discard_all(self): buffer = ByteBuffer() buffer.write(b"abcdefghi") assert buffer.discard() is None assert buffer.read() == b""