Skip to content

Commit 6ab75d9

Browse files
ultrabugfruch
authored andcommitted
ResultSet: add tests to cover paging with empty pages
Related to #102
1 parent 5fb2753 commit 6ab75d9

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/unit/test_resultset.py

+13
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,19 @@ def test_iter_paged(self):
4141
type(response_future).has_more_pages = PropertyMock(side_effect=(True, True, False)) # after init to avoid side effects being consumed by init
4242
self.assertListEqual(list(itr), expected)
4343

44+
def test_iter_paged_with_empty_pages(self):
45+
expected = list(range(10))
46+
response_future = Mock(has_more_pages=True, _continuous_paging_session=None)
47+
response_future.result.side_effect = [
48+
ResultSet(Mock(), []),
49+
ResultSet(Mock(), [0, 1, 2, 3, 4]),
50+
ResultSet(Mock(), []),
51+
ResultSet(Mock(), [5, 6, 7, 8, 9]),
52+
]
53+
rs = ResultSet(response_future, [])
54+
itr = iter(rs)
55+
self.assertListEqual(list(itr), expected)
56+
4457
def test_list_non_paged(self):
4558
# list access on RS for backwards-compatibility
4659
expected = list(range(10))

0 commit comments

Comments
 (0)