def test_should_return_rest_of_data_on_last_iteration(self): input = ['1234', '56'] result = list(data_collector(input, def_buf_size=3)) self.assertEqual(result, ['123', '456'])
def test_should_be_able_to_yield_data_less_than_buffer_size(self): input = ['123'] result = list(data_collector(input, def_buf_size=6)) self.assertEqual(result, ['123'])
def test_a_single_item_should_still_be_buffered_even_if_it_is_above_the_buffer_size( self): input = ['123456'] result = list(data_collector(input, def_buf_size=3)) self.assertEqual(result, ['123', '456'])
def test_should_be_able_to_read_every_byte_of_data(self): input = ['12345'] result = list(data_collector(input, def_buf_size=3)) self.assertEqual(result, ['123', '45'])
def test_should_be_able_to_read_single_yield(self): input = ['123'] result = list(data_collector(input, def_buf_size=3)) self.assertEqual(result, ['123'])
def test_should_return_rest_of_data_on_last_iteration(self): input = [b'1234', b'56'] result = list(data_collector(input, def_buf_size=3)) self.assertEqual(result, [b'123', b'456'])
def test_a_single_item_should_still_be_buffered_even_if_it_is_above_the_buffer_size(self): input = [b'123456'] result = list(data_collector(input, def_buf_size=3)) self.assertEqual(result, [b'123', b'456'])
def test_should_be_able_to_yield_data_less_than_buffer_size(self): input = [b'123'] result = list(data_collector(input, def_buf_size=6)) self.assertEqual(result, [b'123'])
def test_should_be_able_to_read_single_yield(self): input = [b'123'] result = list(data_collector(input, def_buf_size=3)) self.assertEqual(result, [b'123'])
def test_should_be_able_to_read_every_byte_of_data(self): input = [b'12345'] result = list(data_collector(input, def_buf_size=3)) self.assertEqual(result, [b'123', b'45'])