Let PagedList work with iterators.

This commit is contained in:
Andrew Hamilton 2020-03-31 14:50:54 +10:00
parent 4742d152c8
commit c9376e2bd3
2 changed files with 14 additions and 5 deletions

View file

@ -13,6 +13,10 @@ import eris.paged_list as paged_list
class PagedListTestCase(unittest.TestCase):
def test_batch(self):
self.assertEqual(list(paged_list.batch(iter([3,4,5,6,7]), 2)),
[[3, 4], [5, 6], [7]])
def test_getitem(self):
with tempfile.TemporaryDirectory() as temp_dir:
list_ = paged_list.PagedList([3, 4, 5, 6], temp_dir, 4, 2)