[utils] PagedList: Fix empty slices (#17843)

Authored by: doe1080
This commit is contained in:
doe1080
2026-12-01 01:35:10 +00:00
committed by GitHub
parent 0dfab12e75
commit 573de15470
2 changed files with 4 additions and 0 deletions
+2
View File
@@ -807,6 +807,8 @@ class TestUtil(unittest.TestCase):
testPL(5, 2, (0, 3), [0, 1, 2])
testPL(5, 2, (1, 4), [1, 2, 3])
testPL(5, 2, (2, 99), [2, 3, 4])
testPL(5, 2, (0, 0), [])
testPL(5, 2, (2, 1), [])
testPL(5, 2, (20, 99), [])
def test_read_batch_urls(self):
+2
View File
@@ -2337,6 +2337,8 @@ class PagedList:
return page_results
def getslice(self, start=0, end=None):
if end is not None and start >= end:
return []
return list(self._getslice(start, end))
def _getslice(self, start, end):