Skip to content

Commit 2a76f76

Browse files
author
renaud gaudin
committed
restored suggest test in creator test
1 parent c5ff5ab commit 2a76f76

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

tests/test_libzim_creator.py

Lines changed: 10 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.suggestion import SuggestionSearcher
1516
from libzim.writer import (
1617
Blob,
1718
ContentProvider,
@@ -444,9 +445,15 @@ def test_creator_redirection(fpath, lipsum_item):
444445
== zim.get_entry_by_path(HOME_PATH).path
445446
)
446447
assert zim.get_entry_by_path("accueil").get_item().path == HOME_PATH
447-
# TODO: restore [search-api]
448-
# assert "home" in list(zim.suggest("hello"))
449-
# assert "accueil" in list(zim.suggest("bonjour"))
448+
449+
# suggestions
450+
sugg_searcher = SuggestionSearcher(zim)
451+
sugg_hello = sugg_searcher.suggest("hello")
452+
assert "home" in list(sugg_hello.getResults(0, sugg_hello.getEstimatedMatches()))
453+
sugg_bonjour = sugg_searcher.suggest("bonjour")
454+
assert "accueil" in list(
455+
sugg_bonjour.getResults(0, sugg_hello.getEstimatedMatches())
456+
)
450457

451458

452459
def test_item_notimplemented(fpath, lipsum_item):

0 commit comments

Comments
 (0)