コード例 #1
0
 def test_read_bytes(self):
     io = IterIO(iter(['hello', 'world']))
     for i, c in enumerate('helloworld'):
         assert io.tell() == i
         assert io.read(1) == c
     assert io.read(1) == ''
     assert io.tell() == len('helloworld')
コード例 #2
0
 def test_read_length(self):
     io = IterIO(iter(['hello', 'world']))
     for c in 'hel', 'low', 'orl', 'd':
         assert io.read(3) == c
     assert io.read(1) == ''
     assert io.tell() == len('helloworld')
     io = IterIO(iter(['hello', 'world']))
     for c in 'hell', 'owor', 'ld':
         assert io.read(4) == c
     assert io.read(1) == ''
     assert io.tell() == len('helloworld')
コード例 #3
0
 def test_read_all(self):
     io = IterIO(iter(['hello', 'world']))
     assert io.read() == 'helloworld'
     assert io.read() == ''
     assert io.tell() == len('helloworld')