Skip to content

Commit 328f4fe

Browse files
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
1 parent 199722a commit 328f4fe

File tree

1 file changed

+0
-11
lines changed

1 file changed

+0
-11
lines changed

glance/tests/unit/common/test_utils.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -221,17 +221,6 @@ def test_cooperative_reader_unbounded_read_on_empty_iterator(self):
221221
reader = utils.CooperativeReader([])
222222
self.assertEqual(b'', reader.read())
223223

224-
def test_cooperative_reader_of_iterator_stop_iteration_err(self):
225-
"""Ensure cooperative reader supports iterator backends too"""
226-
reader = utils.CooperativeReader([l * 3 for l in ''])
227-
chunks = []
228-
while True:
229-
chunks.append(reader.read(3))
230-
if chunks[-1] == b'':
231-
break
232-
meat = b''.join(chunks)
233-
self.assertEqual(b'', meat)
234-
235224
def _create_generator(self, chunk_size, max_iterations):
236225
chars = b'abc'
237226
iteration = 0

0 commit comments

Comments
 (0)