1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-15 00:03:28 +01:00

cdx: fix the 'yield nothing' case when limit==1

add additional test case for limit==1 and reverse=True,
as limit is optimized out
This commit is contained in:
Ilya Kreymer 2014-03-06 16:01:49 -08:00
parent 4e71a0b772
commit c42a96386f
3 changed files with 9 additions and 0 deletions

View File

@ -122,6 +122,8 @@ def cdx_reverse(cdx_iter, limit):
for cdx in cdx_iter:
last = cdx
if not last:
return
yield last
reverse_cdxs = deque(maxlen=limit)

View File

@ -28,6 +28,10 @@ org,iana)/_js/2013.1/jquery.js 20140126201307 https://www.iana.org/_js/2013.1/jq
Traceback (most recent call last):
CaptureNotFoundException: No Captures found for: http://iana.org/dont_have_this
# No matching -- limit=1
>>> cdx_ops_test('http://iana.org/dont_have_this', reverse = True, resolveRevisits = True, limit = 1)
Traceback (most recent call last):
CaptureNotFoundException: No Captures found for: http://iana.org/dont_have_this
# Filter cdx (default: regex)
>>> cdx_ops_test(url = 'http://iana.org/domains', matchType = 'prefix', filter = ['mimetype:text/html'])

View File

@ -45,6 +45,9 @@ def test_closest():
def test_limit():
lazy_cdx_load(key=KEY, limit=10)
def test_limit_1_reverse():
lazy_cdx_load(key=KEY, limit=1, reverse=True)
def test_multi_ops():
lazy_cdx_load(key=KEY,
resolveRevisits=True,