44import base64
55import datetime
66import io
7- import os
87import pathlib
98import random
109import shutil
@@ -119,7 +118,7 @@ def test_noindexlanguage(tmp_path):
119118 creator = Creator (fpath , "welcome" ).config_dev_metadata (Language = "bam" )
120119 creator .config_indexing (False )
121120 with creator as creator :
122- creator .add_item (StaticItem (path = "welcome" , content = "hello" )) # pyright: ignore
121+ creator .add_item (StaticItem (path = "welcome" , content = "hello" ))
123122 creator .add_item_for ("index" , "Index" , content = "-" , mimetype = "text/html" )
124123
125124 reader = Archive (fpath )
@@ -165,15 +164,11 @@ def test_add_item_for_delete_fail(tmp_path, png_image):
165164 # copy file to local path
166165 shutil .copyfile (png_image , local_path )
167166
168- def remove_source (item ):
169- os .remove (item .filepath )
170-
171167 with Creator (fpath , "welcome" ).config_dev_metadata () as creator :
172168 creator .add_item (
173169 StaticItem (
174- filepath = local_path , # pyright: ignore
175- path = "index" , # pyright: ignore
176- callback = remove_source , # pyright: ignore
170+ filepath = local_path ,
171+ path = "index" ,
177172 ),
178173 callback = (delete_callback , local_path ),
179174 )
@@ -188,18 +183,18 @@ def test_compression(tmp_path):
188183 with Creator (
189184 tmp_path / "test.zim" , "welcome" , compression = "zstd"
190185 ).config_dev_metadata () as creator :
191- creator .add_item (StaticItem (path = "welcome" , content = "hello" )) # pyright: ignore
186+ creator .add_item (StaticItem (path = "welcome" , content = "hello" ))
192187
193188 with Creator (
194189 fpath , "welcome" , compression = Compression .zstd # pyright: ignore
195190 ).config_dev_metadata () as creator :
196- creator .add_item (StaticItem (path = "welcome" , content = "hello" )) # pyright: ignore
191+ creator .add_item (StaticItem (path = "welcome" , content = "hello" ))
197192
198193
199194def test_double_finish (tmp_path ):
200195 fpath = tmp_path / "test.zim"
201196 with Creator (fpath , "welcome" ).config_dev_metadata () as creator :
202- creator .add_item (StaticItem (path = "welcome" , content = "hello" )) # pyright: ignore
197+ creator .add_item (StaticItem (path = "welcome" , content = "hello" ))
203198
204199 # ensure we can finish an already finished creator
205200 creator .finish ()
@@ -219,11 +214,7 @@ def test_sourcefile_removal(tmp_path, html_file):
219214 # copy html to folder
220215 src_path = pathlib .Path (tmpdir .name , "source.html" )
221216 shutil .copyfile (html_file , src_path )
222- creator .add_item (
223- StaticItem (
224- filepath = src_path , path = src_path .name , ref = tmpdir # pyright: ignore
225- )
226- )
217+ creator .add_item (StaticItem (filepath = src_path , path = src_path .name , ref = tmpdir ))
227218 del tmpdir
228219
229220 assert not src_path .exists ()
@@ -241,7 +232,7 @@ def test_sourcefile_removal_std(tmp_path, html_file):
241232 StaticItem (
242233 filepath = paths [- 1 ],
243234 path = paths [- 1 ].name ,
244- mimetype = "text/html" , # pyright: ignore
235+ mimetype = "text/html" ,
245236 ),
246237 callback = (delete_callback , paths [- 1 ]),
247238 )
0 commit comments