Example #1
0
 def test_blocksize(self):
     s = BytesIO(b"1234567890abcdefghijklmnopqrstuvwxyz")
     s = tcp.Reader(s)
     s.BLOCKSIZE = 2
     assert s.read(1) == b"1"
     assert s.read(2) == b"23"
     assert s.read(3) == b"456"
     assert s.read(4) == b"7890"
     d = s.read(-1)
     assert d.startswith(b"abc") and d.endswith(b"xyz")
Example #2
0
 def test_blocksize(self):
     s = BytesIO(b"1234567890abcdefghijklmnopqrstuvwxyz")
     s = tcp.Reader(s)
     s.BLOCKSIZE = 2
     assert s.read(1) == b"1"
     assert s.read(2) == b"23"
     assert s.read(3) == b"456"
     assert s.read(4) == b"7890"
     d = s.read(-1)
     assert d.startswith(b"abc") and d.endswith(b"xyz")