def testPL(size, pagesize, sliceargs, expected):

    def get_page(pagenum):
        firstid = (pagenum * pagesize)
        upto = min(size, ((pagenum * pagesize) + pagesize))
        (yield from range(firstid, upto))
    pl = OnDemandPagedList(get_page, pagesize)
    got = pl.getslice(*sliceargs)
    self.assertEqual(got, expected)
    iapl = InAdvancePagedList(get_page, ((size // pagesize) + 1), pagesize)
    got = iapl.getslice(*sliceargs)
    self.assertEqual(got, expected)
def testPL(size, pagesize, sliceargs, expected):

    def get_page(pagenum):
        firstid = (pagenum * pagesize)
        upto = min(size, ((pagenum * pagesize) + pagesize))
        (yield from range(firstid, upto))
    pl = OnDemandPagedList(get_page, pagesize)
    got = pl.getslice(*sliceargs)
    self.assertEqual(got, expected)
    iapl = InAdvancePagedList(get_page, ((size // pagesize) + 1), pagesize)
    got = iapl.getslice(*sliceargs)
    self.assertEqual(got, expected)