mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-24 06:59:52 +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:
parent
4e71a0b772
commit
c42a96386f
@ -122,6 +122,8 @@ def cdx_reverse(cdx_iter, limit):
|
|||||||
for cdx in cdx_iter:
|
for cdx in cdx_iter:
|
||||||
last = cdx
|
last = cdx
|
||||||
|
|
||||||
|
if not last:
|
||||||
|
return
|
||||||
yield last
|
yield last
|
||||||
|
|
||||||
reverse_cdxs = deque(maxlen=limit)
|
reverse_cdxs = deque(maxlen=limit)
|
||||||
|
@ -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):
|
Traceback (most recent call last):
|
||||||
CaptureNotFoundException: No Captures found for: http://iana.org/dont_have_this
|
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)
|
# Filter cdx (default: regex)
|
||||||
>>> cdx_ops_test(url = 'http://iana.org/domains', matchType = 'prefix', filter = ['mimetype:text/html'])
|
>>> cdx_ops_test(url = 'http://iana.org/domains', matchType = 'prefix', filter = ['mimetype:text/html'])
|
||||||
|
@ -45,6 +45,9 @@ def test_closest():
|
|||||||
def test_limit():
|
def test_limit():
|
||||||
lazy_cdx_load(key=KEY, limit=10)
|
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():
|
def test_multi_ops():
|
||||||
lazy_cdx_load(key=KEY,
|
lazy_cdx_load(key=KEY,
|
||||||
resolveRevisits=True,
|
resolveRevisits=True,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user