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

Strip empty lines from index_content for test

This commit is contained in:
Tessa Walsh 2024-04-24 01:32:30 +02:00
parent e71159c25b
commit 786205921c
2 changed files with 1 additions and 2 deletions

View File

@ -228,8 +228,6 @@ directory structure expected by pywb
wacz_index = open(wacz_index_path, 'rb') wacz_index = open(wacz_index_path, 'rb')
for line in wacz_index: for line in wacz_index:
if not line:
continue
cdx_object = CDXObject(cdxline=line) cdx_object = CDXObject(cdxline=line)
if cdx_object['filename'] in filename_mapping: if cdx_object['filename'] in filename_mapping:
cdx_object['filename'] = filename_mapping[cdx_object['filename']] cdx_object['filename'] = filename_mapping[cdx_object['filename']]

View File

@ -91,6 +91,7 @@ class TestManager:
{'example-collection.warc': 'rewritten.warc'}) {'example-collection.warc': 'rewritten.warc'})
with open(os.path.join(manager.indexes_dir, manager.DEF_INDEX_FILE), 'r') as f: with open(os.path.join(manager.indexes_dir, manager.DEF_INDEX_FILE), 'r') as f:
index_content = f.read() index_content = f.read()
index_content = index_content.strip()
assert 'example-collection.warc' not in index_content assert 'example-collection.warc' not in index_content
assert 'rewritten.warc' in index_content assert 'rewritten.warc' in index_content