Exemplo n.º 1
0
 def test_length(self) -> None:
     buf = fp.Buffer()
     data = b"xyzabc"
     buf.feed(data)
     assert len(buf) == len(data)
Exemplo n.º 2
0
 def test_consume_exactly_with_more_than_sufficient_data(self) -> None:
     buf = fp.Buffer(b"xxyyy")
     assert buf.consume_exactly(2) == b"xx"
Exemplo n.º 3
0
 def test_consume_exactly_with_insufficient_data(self) -> None:
     buf = fp.Buffer(b"xx")
     assert buf.consume_exactly(3) is None
Exemplo n.º 4
0
 def test_consume_at_most_with_no_data(self) -> None:
     buf = fp.Buffer()
     assert buf.consume_at_most(1) == bytearray()
Exemplo n.º 5
0
 def test_consume_at_most_with_insufficient_data(self) -> None:
     buf = fp.Buffer(b"xx")
     assert buf.consume_at_most(3) == b"xx"
Exemplo n.º 6
0
 def test_consume_at_most_zero_bytes(self) -> None:
     buf = fp.Buffer(b"xxyyy")
     assert buf.consume_at_most(0) == bytearray()
Exemplo n.º 7
0
 def test_length(self):
     buf = fp.Buffer()
     data = b'xyzabc'
     buf.feed(data)
     assert len(buf) == len(data)
Exemplo n.º 8
0
 def test_consume_exactly_with_more_than_sufficient_data(self):
     buf = fp.Buffer(b'xxyyy')
     assert buf.consume_exactly(2) == b'xx'
Exemplo n.º 9
0
 def test_consume_at_most_with_insufficient_data(self):
     buf = fp.Buffer(b'xx')
     assert buf.consume_at_most(3) == b'xx'
Exemplo n.º 10
0
 def test_consume_at_most_zero_bytes(self):
     buf = fp.Buffer(b'xxyyy')
     assert buf.consume_at_most(0) == bytearray()