You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tests/unit/test_resultset.py
+7-4Lines changed: 7 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,8 @@ def test_iter_paged(self):
37
37
response_future.result.side_effect= (ResultSet(Mock(), expected[-5:]), ) # ResultSet is iterable, so it must be protected in order to be returned whole by the Mock
38
38
rs=ResultSet(response_future, expected[:5])
39
39
itr=iter(rs)
40
-
type(response_future).has_more_pages=PropertyMock(side_effect=(True, False)) # after init to avoid side effects being consumed by init
40
+
# this is brittle, depends on internal impl details. Would like to find a better way
41
+
type(response_future).has_more_pages=PropertyMock(side_effect=(True, True, False)) # after init to avoid side effects being consumed by init
41
42
self.assertListEqual(list(itr), expected)
42
43
43
44
deftest_list_non_paged(self):
@@ -54,7 +55,8 @@ def test_list_paged(self):
54
55
response_future=Mock(has_more_pages=True)
55
56
response_future.result.side_effect= (ResultSet(Mock(), expected[-5:]), ) # ResultSet is iterable, so it must be protected in order to be returned whole by the Mock
56
57
rs=ResultSet(response_future, expected[:5])
57
-
type(response_future).has_more_pages=PropertyMock(side_effect=(True, True, False)) # one True for getitem check/warn, then True, False for two pages
58
+
# this is brittle, depends on internal impl details. Would like to find a better way
59
+
type(response_future).has_more_pages=PropertyMock(side_effect=(True, True, True, False)) # First two True are consumed on check entering list mode
response_future.result.side_effect= (ResultSet(Mock(), expected[-5:]), ) # ResultSet is iterable, so it must be protected in order to be returned whole by the Mock
121
123
rs=ResultSet(response_future, expected[:5])
122
-
type(response_future).has_more_pages=PropertyMock(side_effect=(True, True, False)) # First True is consumed on check entering list mode
124
+
# this is brittle, depends on internal impl details. Would like to find a better way
125
+
type(response_future).has_more_pages=PropertyMock(side_effect=(True, True, True, False)) # First two True are consumed on check entering list mode
123
126
# index access before iteration causes list to be materialized
124
127
self.assertEqual(rs[0], expected[0])
125
128
self.assertEqual(rs[9], expected[9])
@@ -146,7 +149,7 @@ def test_eq(self):
146
149
response_future=Mock(has_more_pages=True)
147
150
response_future.result.side_effect= (ResultSet(Mock(), expected[-5:]), ) # ResultSet is iterable, so it must be protected in order to be returned whole by the Mock
0 commit comments