147147 "test_content_includes" : "looking forward to your contributions." ,
148148 "test_redirect" : None ,
149149 },
150- "corner_cases.zim" : {
151- "filename" : "corner_cases.zim" ,
152- "filesize" : 75741 ,
153- "new_ns" : False ,
150+ "corner_cases%23%26 .zim" : {
151+ "filename" : "corner_cases%23%26 .zim" ,
152+ "filesize" : 35991 ,
153+ "new_ns" : True ,
154154 "mutlipart" : False ,
155- "zim_uuid" : "9150439f963dff9ec91ca09a41962d71 " ,
155+ "zim_uuid" : "702abcbe6fe926152f5d451af7986437 " ,
156156 "metadata_keys" : [
157157 "Counter" ,
158- "Creator" ,
159158 "Date" ,
160- "Description" ,
161- "Flavour" ,
159+ "Illustration_48x48@1" ,
162160 "Language" ,
163- "Name" ,
164- "Publisher" ,
165161 "Scraper" ,
166- "Source" ,
167162 "Tags" ,
168163 "Title" ,
169164 ],
170165 "test_metadata" : "Title" ,
171- "test_metadata_value" : "= ZIM corner cases" ,
166+ "test_metadata_value" : "ZIM corner cases" ,
172167 "has_main_entry" : True ,
173168 "has_favicon_entry" : True ,
174- "has_fulltext_index" : True ,
169+ "has_fulltext_index" : False ,
175170 "has_title_index" : True ,
176171 "has_checksum" : True ,
177172 "checksum" : None ,
178173 "is_valid" : True ,
179- "entry_count" : 19 ,
180- "all_entry_count" : 19 ,
181- "article_count" : 1 ,
174+ "entry_count" : 7 ,
175+ "all_entry_count" : 18 ,
176+ "article_count" : 2 ,
182177 "media_count" : 1 ,
183- "suggestion_string" : "empty " ,
178+ "suggestion_string" : "c# " ,
184179 "suggestion_count" : 1 ,
185- "suggestion_result" : ["A/empty .html" ],
186- "search_string" : "empty" ,
187- "search_count" : 1 ,
188- "search_result" : ["A/empty.html" ],
189- "test_path" : "A/ empty.html" ,
190- "test_title" : "empty" ,
180+ "suggestion_result" : ["c# .html" ],
181+ "search_string" : None ,
182+ "search_count" : 0 ,
183+ "search_result" : [],
184+ "test_path" : "empty.html" ,
185+ "test_title" : "empty.html " ,
191186 "test_mimetype" : "text/html" ,
192187 "test_size" : 0 ,
193188 "test_content_includes" : "" ,
194- "test_redirect" : "-/favicon" ,
195- "test_redirect_to" : "I/empty.png" ,
189+ "test_redirect" : None ,
190+ "test_redirect_to" : None ,
196191 },
197192 "small.zim" : {
198193 "filename" : "small.zim" ,
@@ -271,8 +266,8 @@ def all_zims(tmpdir_factory):
271266 temp_dir = tmpdir_factory .mktemp ("data" )
272267
273268 libzim_urls = [
274- f"https://github.com/kiwix/libkiwix/raw/master /test/data/{ name } "
275- for name in ("zimfile.zim" , "example.zim" , "corner_cases.zim" )
269+ f"https://github.com/kiwix/libkiwix/raw/main /test/data/{ name } "
270+ for name in ("zimfile.zim" , "example.zim" , "corner_cases%23%26 .zim" )
276271 ] + ["https://github.com/openzim/zim-testing-suite/raw/main/data/nons/small.zim" ]
277272
278273 # download libzim tests
@@ -335,6 +330,7 @@ def get_content():
335330)
336331def test_reader_archive (all_zims , filename , filesize , new_ns , mutlipart , zim_uuid ):
337332 fpath = all_zims / filename
333+
338334 zim = Archive (fpath )
339335
340336 # check externaly verifiable data
@@ -370,7 +366,7 @@ def test_reader_metadata(
370366 if test_metadata :
371367 assert zim .get_metadata (test_metadata ).decode ("UTF-8" ) == test_metadata_value
372368 item = zim .get_metadata_item (test_metadata )
373- assert item .mimetype == "text/plain"
369+ assert item .mimetype in ( "text/plain" , "text/plain;charset=utf-8" ) # newer
374370 assert item .size > 1
375371
376372
@@ -444,6 +440,7 @@ def test_reader_checksum(all_zims, filename, has_checksum, is_valid):
444440 "all_entry_count" ,
445441 "article_count" ,
446442 "media_count" ,
443+ "has_fulltext_index" ,
447444 "suggestion_string" ,
448445 "suggestion_count" ,
449446 "suggestion_result" ,
@@ -460,6 +457,7 @@ def test_reader_suggest_search(
460457 all_entry_count ,
461458 article_count ,
462459 media_count ,
460+ has_fulltext_index ,
463461 suggestion_string ,
464462 suggestion_count ,
465463 suggestion_result ,
@@ -475,7 +473,7 @@ def test_reader_suggest_search(
475473 assert zim .article_count == article_count
476474 assert zim .media_count == media_count
477475
478- if search_string is not None :
476+ if has_fulltext_index and search_string is not None :
479477 query = Query ().set_query (search_string )
480478 searcher = Searcher (zim )
481479 search = searcher .search (query )
0 commit comments