Skip to content

Commit 2171e0c

Browse files
author
renaud gaudin
committed
Restored a search test as upstream is fixed
Creation tests had to comment out a search test due to upstream bug #481 that got fixed in April 2021. This updates test to new API and restores it
1 parent cb22a89 commit 2171e0c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tests/test_libzim_creator.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import libzim.writer
1414
from libzim.reader import Archive
15+
from libzim.search import Query, Searcher
1516
from libzim.suggestion import SuggestionSearcher
1617
from libzim.writer import (
1718
Blob,
@@ -232,15 +233,17 @@ def test_creator_clustersize(fpath, cluster_size, lipsum_item):
232233
],
233234
)
234235
def test_creator_indexing(fpath, lipsum_item, indexing, language, expected):
235-
fpath = "lolo.zim"
236236
with Creator(fpath).config_indexing(indexing, language) as c:
237237
c.add_item(lipsum_item)
238238

239239
zim = Archive(fpath)
240240
assert zim.has_fulltext_index == indexing
241241

242-
# upstream bug https://github.com/openzim/libzim/issues/481
243-
# assert zim.get_estimated_search_results_count("standard") == expected
242+
if indexing:
243+
query = Query().set_query("standard")
244+
searcher = Searcher(zim)
245+
search = searcher.search(query)
246+
assert search.getEstimatedMatches() == expected
244247

245248

246249
@pytest.mark.parametrize("nb_workers", [1, 2, 3, 5])

0 commit comments

Comments
 (0)