@@ -160,9 +160,10 @@ def test_samplezip(self):
160
160
zip_path .unlink ()
161
161
162
162
def test_zip (self ):
163
- tools .test (["zip" , "--force" ])
164
163
zip_path = Path ("identity.zip" )
165
164
165
+ tools .test (["zip" , "--force" ])
166
+
166
167
# The full zip should contain the samples with the original file extensions.
167
168
assert sorted (
168
169
(info .filename , info .file_size )
@@ -178,6 +179,25 @@ def test_zip(self):
178
179
* ((f"identity/data/sample/6.{ ext } .statement" , 2 ) for ext in ["ans" , "in" ]),
179
180
], "Zip contents for data/sample/ are not correct"
180
181
182
+ # The full zip should contain all PDFs in their corresponding directories.
183
+ assert sorted (
184
+ info .filename for info in ZipFile (zip_path ).infolist () if info .filename .endswith (".pdf" )
185
+ ) == [
186
+ f"identity/{ path } .{ lang } .pdf"
187
+ for path in ["problem_slide/problem-slide" , "solution/solution" , "statement/problem" ]
188
+ for lang in ["de" , "en" ]
189
+ ], "Zip contents for PDFs with both languages are not correct"
190
+
191
+ tools .test (["zip" , "--force" , "--lang" , "en" ])
192
+
193
+ # The full zip should contain all PDFs in their corresponding directories.
194
+ assert sorted (
195
+ info .filename for info in ZipFile (zip_path ).infolist () if info .filename .endswith (".pdf" )
196
+ ) == [
197
+ f"identity/{ path } .en.pdf"
198
+ for path in ["problem_slide/problem-slide" , "solution/solution" , "statement/problem" ]
199
+ ], "Zip contents for PDFs with `--lang en` are not correct"
200
+
181
201
zip_path .unlink ()
182
202
183
203
# Misc
@@ -234,6 +254,32 @@ def test_problem_slides(self):
234
254
def test_gitlabci (self ):
235
255
tools .test (["gitlabci" ])
236
256
257
+ def test_zip (self ):
258
+ zip_path = Path ("problems.zip" )
259
+
260
+ for languages in [["en" , "de" ], ["en" ]]:
261
+ tools .test (["zip" , "--force" , "--lang" , * languages ])
262
+
263
+ # The full zip should contain all PDFs in their corresponding directories.
264
+ assert sorted (info .filename for info in ZipFile (zip_path ).infolist ()) == sorted (
265
+ [
266
+ "contest.yaml" ,
267
+ "identity.zip" ,
268
+ "problems.yaml" ,
269
+ "samples.zip" ,
270
+ * (
271
+ f"{ name } { suffix } .{ lang } .pdf"
272
+ for name in ["contest" , "solutions" , "problem-slides" ]
273
+ for lang in languages
274
+ for suffix in ["" , "-web" ]
275
+ # The problem slides do not have a -web version.
276
+ if (name , suffix ) != ("problem-slides" , "-web" )
277
+ ),
278
+ ]
279
+ ), f"Zip contents for contest zip are not correct for languages { languages } "
280
+
281
+ zip_path .unlink ()
282
+
237
283
238
284
@pytest .fixture (scope = "function" )
239
285
def tmp_contest_dir (tmp_path ):
0 commit comments