4
4
import base64
5
5
import datetime
6
6
import io
7
- import os
8
7
import pathlib
9
8
import random
10
9
import shutil
@@ -119,7 +118,7 @@ def test_noindexlanguage(tmp_path):
119
118
creator = Creator (fpath , "welcome" ).config_dev_metadata (Language = "bam" )
120
119
creator .config_indexing (False )
121
120
with creator as creator :
122
- creator .add_item (StaticItem (path = "welcome" , content = "hello" )) # pyright: ignore
121
+ creator .add_item (StaticItem (path = "welcome" , content = "hello" ))
123
122
creator .add_item_for ("index" , "Index" , content = "-" , mimetype = "text/html" )
124
123
125
124
reader = Archive (fpath )
@@ -165,15 +164,11 @@ def test_add_item_for_delete_fail(tmp_path, png_image):
165
164
# copy file to local path
166
165
shutil .copyfile (png_image , local_path )
167
166
168
- def remove_source (item ):
169
- os .remove (item .filepath )
170
-
171
167
with Creator (fpath , "welcome" ).config_dev_metadata () as creator :
172
168
creator .add_item (
173
169
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" ,
177
172
),
178
173
callback = (delete_callback , local_path ),
179
174
)
@@ -188,18 +183,18 @@ def test_compression(tmp_path):
188
183
with Creator (
189
184
tmp_path / "test.zim" , "welcome" , compression = "zstd"
190
185
).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" ))
192
187
193
188
with Creator (
194
189
fpath , "welcome" , compression = Compression .zstd # pyright: ignore
195
190
).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" ))
197
192
198
193
199
194
def test_double_finish (tmp_path ):
200
195
fpath = tmp_path / "test.zim"
201
196
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" ))
203
198
204
199
# ensure we can finish an already finished creator
205
200
creator .finish ()
@@ -219,11 +214,7 @@ def test_sourcefile_removal(tmp_path, html_file):
219
214
# copy html to folder
220
215
src_path = pathlib .Path (tmpdir .name , "source.html" )
221
216
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 ))
227
218
del tmpdir
228
219
229
220
assert not src_path .exists ()
@@ -241,7 +232,7 @@ def test_sourcefile_removal_std(tmp_path, html_file):
241
232
StaticItem (
242
233
filepath = paths [- 1 ],
243
234
path = paths [- 1 ].name ,
244
- mimetype = "text/html" , # pyright: ignore
235
+ mimetype = "text/html" ,
245
236
),
246
237
callback = (delete_callback , paths [- 1 ]),
247
238
)
0 commit comments