Remove useless test for the CooperativeReader class

test_cooperative_reader_of_iterator_stop_iteration_err passes an empty
list to utils.CooperativeReader since "[l * 3 for l in '']" evaluates to
an empty list. The
test_cooperative_reader_unbounded_read_on_empty_iterator also
initializes utils.CooperativeReader this way.

The function's docstring is a copy/paste of
test_cooperative_reader_of_iterator's.  Judging by the method's name, it
seems its goal was to make sure the StopIteration exception was properly
handled in CooperativeReader.read(), which is already tested by the
following methods:

- test_cooperative_reader_of_iterator
- test_cooperative_reader_on_iterator_with_buffer
- test_cooperative_reader_unbounded_read_on_iterator
- test_cooperative_reader_preserves_size_chunk_equals_read
- test_cooperative_reader_preserves_size_chunk_less_then_read
- test_cooperative_reader_preserves_size_chunk_more_then_read
- test_cooperative_reader_unbounded_read_on_empty_iterator

The test_cooperative_reader_of_iterator_stop_iteration_err therefore
seems useless and is removed in this commit.

Change-Id: I28834aab2602f59cbfa3ba061ab245af7ac56c40
This commit is contained in:
Cyril Roelandt 2022-11-22 20:24:05 +01:00
parent 199722a65a
commit 328f4fe25a
1 changed files with 0 additions and 11 deletions

View File

@ -221,17 +221,6 @@ class TestUtils(test_utils.BaseTestCase):
reader = utils.CooperativeReader([])
self.assertEqual(b'', reader.read())
def test_cooperative_reader_of_iterator_stop_iteration_err(self):
"""Ensure cooperative reader supports iterator backends too"""
reader = utils.CooperativeReader([l * 3 for l in ''])
chunks = []
while True:
chunks.append(reader.read(3))
if chunks[-1] == b'':
break
meat = b''.join(chunks)
self.assertEqual(b'', meat)
def _create_generator(self, chunk_size, max_iterations):
chars = b'abc'
iteration = 0