Skip to content

Commit 7db4684

Browse files
committed
fixup! Add support for new illustrations APIs in libzim 9.4.0
1 parent de46d68 commit 7db4684

File tree

9 files changed

+275
-109
lines changed

9 files changed

+275
-109
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ with Creator("test.zim").config_indexing(True, "eng") as creator:
134134
creator.set_mainpath("home")
135135
creator.add_item(item)
136136
creator.add_item(item2)
137-
creator.add_illustration(48, illustration)
137+
# equivalent to old-style creator.add_illustration(48, illustration)
138+
creator.add_illustration(IllustrationInfo(48, 48, 1.0), illustration)
138139
for name, value in {
139140
"creator": "python-libzim",
140141
"description": "Created in python",

libzim/libzim.pyx

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ cdef class _Creator:
479479
self.c_creator.setMainPath(mainPath.encode('UTF-8'))
480480
return self
481481
482-
def add_illustration(self, size_or_info, content: bytes):
482+
def add_illustration(self, size_or_info: Union[pyint, IllustrationInfo], content: bytes):
483483
"""Add a PNG illustration to Archive.
484484

485485
Refer to https://wiki.openzim.org/wiki/Metadata for more details.
@@ -761,6 +761,7 @@ with Creator(pathlib.Path("myfile.zim")) as creator:
761761
# example
762762
creator.add_item(MyItemSubclass(path, title, mimetype, content)
763763
creator.set_mainpath(path)
764+
creator.add_illustration(IllustrationInfo(48, 48, 1.0), png_data)
764765
```"""
765766
writer_public_objects = [
766767
Creator,
@@ -789,7 +790,10 @@ cdef class IllustrationInfo:
789790
width (int): Width of the illustration in CSS pixels.
790791
height (int): Height of the illustration in CSS pixels.
791792
scale (float): Device pixel ratio (scale) of the illustration.
792-
extra_attributes (dict): Additional attributes as key-value pairs.
793+
extra_attributes (dict[str, str]): Additional attributes as key-value pairs.
794+
Note: This property returns a new dict on each access. Direct mutations
795+
like `info.extra_attributes["key"] = value` won't persist. Use the setter:
796+
`info.extra_attributes = {"key": "value"}` to update.
793797
"""
794798
__module__ = illustration_module_name
795799
cdef zim.IllustrationInfo c_info
@@ -1483,26 +1487,41 @@ cdef class Archive:
14831487
return self.c_archive.hasIllustration(size)
14841488
return self.c_archive.hasIllustration()
14851489
1486-
def get_illustration_item(self, size: pyint = None, info: IllustrationInfo = None) -> Item:
1490+
def get_illustration_item(self, size_or_info: Union[pyint, IllustrationInfo] = None) -> Item:
14871491
"""Get the illustration Metadata item of the archive.
14881492

14891493
Args:
1490-
size: Optional size of the illustration (for backward compatibility).
1491-
info: Optional IllustrationInfo with width, height, and scale.
1494+
size_or_info: Either an int (width of the square PNG illustration in pixels)
1495+
or an IllustrationInfo object with width, height, and scale.
1496+
If None, defaults to size 48.
14921497

14931498
Returns:
14941499
The illustration item.
14951500

1496-
Note:
1497-
Either provide size (int) or info (IllustrationInfo), not both.
1498-
If neither is provided, returns the default illustration item.
1501+
Raises:
1502+
KeyError: If the requested illustration is not found.
1503+
TypeError: If size_or_info is not None, int, or IllustrationInfo.
1504+
1505+
Examples:
1506+
# Get default illustration (48x48@1)
1507+
item = archive.get_illustration_item()
1508+
1509+
# Get illustration by size (square at scale 1)
1510+
item = archive.get_illustration_item(96)
1511+
1512+
# Get illustration by IllustrationInfo (width, height, scale)
1513+
info = IllustrationInfo(48, 48, 2.0)
1514+
item = archive.get_illustration_item(info)
14991515
"""
15001516
try:
1501-
if info is not None:
1502-
return Item.from_item(move(self.c_archive.getIllustrationItem(info.c_info)))
1503-
elif size is not None:
1504-
return Item.from_item(move(self.c_archive.getIllustrationItem(<int>size)))
1505-
return Item.from_item(move(self.c_archive.getIllustrationItem()))
1517+
if size_or_info is None:
1518+
return Item.from_item(move(self.c_archive.getIllustrationItem(<int>48)))
1519+
elif isinstance(size_or_info, IllustrationInfo):
1520+
return Item.from_item(move(self.c_archive.getIllustrationItem((<IllustrationInfo>size_or_info).c_info)))
1521+
elif isinstance(size_or_info, int):
1522+
return Item.from_item(move(self.c_archive.getIllustrationItem(<int>size_or_info)))
1523+
else:
1524+
raise TypeError(f"Argument must be None, int, or IllustrationInfo, not {type(size_or_info)}")
15061525
except RuntimeError as e:
15071526
raise KeyError(str(e))
15081527

libzim/reader.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ class Archive:
8282
@overload
8383
def get_illustration_item(self) -> Item: ...
8484
@overload
85-
def get_illustration_item(self, size: int) -> Item: ...
85+
def get_illustration_item(self, size_or_info: int) -> Item: ...
8686
@overload
87-
def get_illustration_item(self, *, info: IllustrationInfo) -> Item: ...
87+
def get_illustration_item(self, size_or_info: IllustrationInfo) -> Item: ...
8888
@overload
8989
def get_illustration_infos(self) -> list[IllustrationInfo]: ...
9090
@overload

libzim/zim.pxd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ cdef extern from "zim/writer/creator.h" namespace "zim::writer":
8989
void finishZimCreation() except + nogil
9090
void setMainPath(string mainPath)
9191
void addIllustration(unsigned int size, string content) except + nogil
92-
void addIllustration(const IllustrationInfo& ii, string content) nogil except +
92+
void addIllustration(const IllustrationInfo& ii, string content) except + nogil
9393

9494
cdef extern from "zim/search.h" namespace "zim":
9595
cdef cppclass Query:

tests/conftest.py

Lines changed: 100 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,105 @@
44

55

66
@pytest.fixture(scope="module")
7-
def favicon_data():
7+
def favicon_data_48():
8+
"""48x48 white PNG."""
89
return base64.b64decode(
9-
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQ"
10-
"ImWO4ISn6HwAE2QIGKsd69QAAAABJRU5ErkJggg=="
10+
"iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAAASElEQVR4nO3OoQHAIBAAsdL9d3485iSI"
11+
"ZIKsmfle8t8OnISKUBEqQkWoCBWhIlSEilARKkJFqAgVoSJUhIpQESpCRagIFaGyAXGwA118GEzeAAAA"
12+
"AElFTkSuQmCC"
13+
)
14+
15+
16+
@pytest.fixture(scope="module")
17+
def favicon_data_96():
18+
"""96x96 white PNG."""
19+
return base64.b64decode(
20+
"iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAIAAABt+uBvAAAA1ElEQVR4nO3QwQ3AIBDAsNL9dz4mQHnC"
21+
"w54gypqZj7P/dsDrDAoGBYOCQcGgYFAwKBgUDAoGBYOCQcGgYFAwKBgUDAoGBYOCQcGgYFAwKBgUDAoG"
22+
"BYOCQcGgYFAwKBgUDAoGBYOCQcGgYFAwKBgUDAoGBYOCQcGgYFAwKBgUDAoGBYOCQcGgYFAwKBgUDAoG"
23+
"BYOCQcGgYFAwKBgUDAoGBYOCQcGgYFAwKBgUDAoGBYOCQcGgYFAwKBgUDAoGBYOCQcGgYFAwKBgUDAoG"
24+
"BYOCQcGgYFDY+poDvQAivBYAAAAASUVORK5CYII="
25+
)
26+
27+
28+
@pytest.fixture(scope="module")
29+
def favicon_data_64_32():
30+
"""64x32 white PNG."""
31+
return base64.b64decode(
32+
"iVBORw0KGgoAAAANSUhEUgAAAEAAAAAgCAIAAAAt/+nTAAAAQElEQVR4nO3PQQ0AIBDAMMC/50MEj4Zk"
33+
"VbDtmVk/OzrgVQNaA1oDWgNaA1oDWgNaA1oDWgNaA1oDWgNaA1oD2gUyKwM953EnbgAAAABJRU5ErkJg"
34+
"gg=="
35+
)
36+
37+
38+
@pytest.fixture(scope="module")
39+
def favicon_data_128_64():
40+
"""128x64 white PNG."""
41+
return base64.b64decode(
42+
"iVBORw0KGgoAAAANSUhEUgAAAIAAAABACAIAAABdtOgoAAAApUlEQVR4nO3RQREAIAzAMMC/501GHjQK"
43+
"etc7MyfO0wG/awDWAKwBWAOwBmANwBqANQBrANYArAFYA7AGYA3AGoA1AGsA1gCsAVgDsAZgDcAagDUA"
44+
"awDWAKwBWAOwBmANwBqANQBrANYArAFYA7AGYA3AGoA1AGsA1gCsAVgDsAZgDcAagDUAawDWAKwBWAOw"
45+
"BmANwBqANQBrANYArAFYA7AGYA3AFhvOA32iFHl+AAAAAElFTkSuQmCC"
46+
)
47+
48+
49+
@pytest.fixture(scope="module")
50+
def favicon_data_64_128():
51+
"""64x128 white PNG."""
52+
return base64.b64decode(
53+
"iVBORw0KGgoAAAANSUhEUgAAAEAAAACACAIAAAA04/g9AAAAoElEQVR4nO3PQQ0AIBDAMMC/50MEj4Zk"
54+
"VbDtmVk/OzrgVQNaA1oDWgNaA1oDWgNaA1oDWgNaA1oDWgNaA1oDWgNaA1oDWgNaA1oDWgNaA1oDWgNa"
55+
"A1oDWgNaA1oDWgNaA1oDWgNaA1oDWgNaA1oDWgNaA1oDWgNaA1oDWgNaA1oDWgNaA1oDWgNaA1oDWgNa"
56+
"A1oDWgNaA1oDWgNaA1oD2gUMxQP9ijHcFQAAAABJRU5ErkJggg=="
57+
)
58+
59+
60+
@pytest.fixture(scope="module")
61+
def favicon_data_144():
62+
"""144x144 white PNG (for 48x48@3)."""
63+
return base64.b64decode(
64+
"iVBORw0KGgoAAAANSUhEUgAAAJAAAACQCAIAAABoJHXvAAABY0lEQVR4nO3RwQkAIBDAMHX/nc8ZfEkh"
65+
"maDQPTOLjvM7gDeGxRgWY1iMYTGGxRgWY1iMYTGGxRgWY1iMYTGGxRgWY1iMYTGGxRgWY1iMYTGGxRgW"
66+
"Y1iMYTGGxRgWY1iMYTGGxRgWY1iMYTGGxRgWY1iMYTGGxRgWY1iMYTGGxRgWY1iMYTGGxRgWY1iMYTGG"
67+
"xRgWY1iMYTGGxRgWY1iMYTGGxRgWY1iMYTGGxRgWY1iMYTGGxRgWY1iMYTGGxRgWY1iMYTGGxRgWY1iM"
68+
"YTGGxRgWY1iMYTGGxRgWY1iMYTGGxRgWY1iMYTGGxRgWY1iMYTGGxRgWY1iMYTGGxRgWY1iMYTGGxRgW"
69+
"Y1iMYTGGxRgWY1iMYTGGxRgWY1iMYTGGxRgWY1iMYTGGxRgWY1iMYTGGxRgWY1iMYTGGxRgWY1iMYTGG"
70+
"xRgWY1iMYTGGxRgWY1iMYTGGxRgWcwH2lQQd7GyBMgAAAABJRU5ErkJggg=="
71+
)
72+
73+
74+
@pytest.fixture(scope="module")
75+
def favicon_data_192():
76+
"""192x192 white PNG (for 96x96@2)."""
77+
return base64.b64decode(
78+
"iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAIAAADdvvtQAAAB6ElEQVR4nO3SwQ3AIBDAsNL9dz52IA+E"
79+
"ZE+QR9bMfHDqvx3A2wxEYiASA5EYiMRAJAYiMRCJgUgMRGIgEgORGIjEQCQGIjEQiYFIDERiIBIDkRiI"
80+
"xEAkBiIxEImBSAxEYiASA5EYiMRAJAYiMRCJgUgMRGIgEgORGIjEQCQGIjEQiYFIDERiIBIDkRiIxEAk"
81+
"BiIxEImBSAxEYiASA5EYiMRAJAYiMRCJgUgMRGIgEgORGIjEQCQGIjEQiYFIDERiIBIDkRiIxEAkBiIx"
82+
"EImBSAxEYiASA5EYiMRAJAYiMRCJgUgMRGIgEgORGIjEQCQGIjEQiYFIDERiIBIDkRiIxEAkBiIxEImB"
83+
"SAxEYiASA5EYiMRAJAYiMRCJgUgMRGIgEgORGIjEQCQGIjEQiYFIDERiIBIDkRiIxEAkBiIxEImBSAxE"
84+
"YiASA5EYiMRAJAYiMRCJgUgMRGIgEgORGIjEQCQGIjEQiYFIDERiIBIDkRiIxEAkBiIxEImBSAxEYiAS"
85+
"A5EYiMRAJAYiMRCJgUgMRGIgEgORGIjEQCQGIjEQiYFIDERiIBIDkRiIxEAkBiIxEImBSAxEYiASA5EY"
86+
"iMRAJAYiMRCJgUgMRGIgEgORGIjEQCQGIjEQiYFIDERiIBIDkRiIxEAkBiLZx2MEfQuoaCoAAAAASUVO"
87+
"RK5CYII="
88+
)
89+
90+
91+
@pytest.fixture(scope="module")
92+
def favicon_data_256():
93+
"""256x256 white PNG."""
94+
return base64.b64decode(
95+
"iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAIAAADTED8xAAACvUlEQVR4nO3TMQEAIAzAMMC/5yFjRxMF"
96+
"fXpn5kDV2w6ATQYgzQCkGYA0A5BmANIMQJoBSDMAaQYgzQCkGYA0A5BmANIMQJoBSDMAaQYgzQCkGYA0"
97+
"A5BmANIMQJoBSDMAaQYgzQCkGYA0A5BmANIMQJoBSDMAaQYgzQCkGYA0A5BmANIMQJoBSDMAaQYgzQCk"
98+
"GYA0A5BmANIMQJoBSDMAaQYgzQCkGYA0A5BmANIMQJoBSDMAaQYgzQCkGYA0A5BmANIMQJoBSDMAaQYg"
99+
"zQCkGYA0A5BmANIMQJoBSDMAaQYgzQCkGYA0A5BmANIMQJoBSDMAaQYgzQCkGYA0A5BmANIMQJoBSDMA"
100+
"aQYgzQCkGYA0A5BmANIMQJoBSDMAaQYgzQCkGYA0A5BmANIMQJoBSDMAaQYgzQCkGYA0A5BmANIMQJoB"
101+
"SDMAaQYgzQCkGYA0A5BmANIMQJoBSDMAaQYgzQCkGYA0A5BmANIMQJoBSDMAaQYgzQCkGYA0A5BmANIM"
102+
"QJoBSDMAaQYgzQCkGYA0A5BmANIMQJoBSDMAaQYgzQCkGYA0A5BmANIMQJoBSDMAaQYgzQCkGYA0A5Bm"
103+
"ANIMQJoBSDMAaQYgzQCkGYA0A5BmANIMQJoBSDMAaQYgzQCkGYA0A5BmANIMQJoBSDMAaQYgzQCkGYA0"
104+
"A5BmANIMQJoBSDMAaQYgzQCkGYA0A5BmANIMQJoBSDMAaQYgzQCkGYA0A5BmANIMQJoBSDMAaQYgzQCk"
105+
"GYA0A5BmANIMQJoBSDMAaQYgzQCkGYA0A5BmANIMQJoBSDMAaQYgzQCkGYA0A5BmANIMQJoBSDMAaQYg"
106+
"zQCkGYA0A5BmANIMQJoBSDMAaQYgzQCkGYA0A5BmANIMQJoBSDMAaQYgzQCkGYA0A5BmANIMQNoHq+gE"
107+
"/QPNMGIAAAAASUVORK5CYII="
11108
)

tests/test_illustration_archive.py

Lines changed: 70 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,3 @@
1-
#!/usr/bin/env python3
2-
3-
# This file is part of python-libzim
4-
# (see https://github.com/libzim/python-libzim)
5-
#
6-
# Copyright (c) 2025 Benoit Arnaud <[email protected]>
7-
#
8-
# This program is free software: you can redistribute it and/or modify
9-
# it under the terms of the GNU General Public License as published by
10-
# the Free Software Foundation, either version 3 of the License, or
11-
# (at your option) any later version.
12-
#
13-
# This program is distributed in the hope that it will be useful,
14-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16-
# GNU General Public License for more details.
17-
#
18-
# You should have received a copy of the GNU General Public License
19-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
20-
211
import pytest
222

233
from libzim.illustration import ( # pyright: ignore [reportMissingModuleSource]
@@ -28,28 +8,43 @@
288

299

3010
@pytest.fixture(scope="function")
31-
def zim_with_varied_illustrations(tmp_path, favicon_data):
11+
def zim_with_varied_illustrations(
12+
tmp_path,
13+
favicon_data_48,
14+
favicon_data_96,
15+
favicon_data_144,
16+
favicon_data_192,
17+
favicon_data_128_64,
18+
favicon_data_64_128,
19+
favicon_data_256,
20+
):
3221
"""Create a ZIM file with various illustration sizes and scales."""
3322
fpath = tmp_path / "test_illustrations.zim"
3423
with Creator(fpath) as c:
3524
c.add_metadata("Title", "Test ZIM")
3625

3726
# Add multiple illustrations with different dimensions and scales
3827
# 48x48 at different scales
39-
c.add_illustration(IllustrationInfo(48, 48, 1.0), favicon_data)
40-
c.add_illustration(IllustrationInfo(48, 48, 2.0), favicon_data)
41-
c.add_illustration(IllustrationInfo(48, 48, 3.0), favicon_data)
28+
c.add_illustration(IllustrationInfo(48, 48, 1.0), favicon_data_48) # 48x48 PNG
29+
c.add_illustration(
30+
IllustrationInfo(48, 48, 2.0), favicon_data_96
31+
) # 96x96 PNG (48*2)
32+
c.add_illustration(
33+
IllustrationInfo(48, 48, 3.0), favicon_data_144
34+
) # 144x144 PNG (48*3)
4235

4336
# 96x96 at different scales
44-
c.add_illustration(IllustrationInfo(96, 96, 1.0), favicon_data)
45-
c.add_illustration(IllustrationInfo(96, 96, 2.0), favicon_data)
37+
c.add_illustration(IllustrationInfo(96, 96, 1.0), favicon_data_96) # 96x96 PNG
38+
c.add_illustration(
39+
IllustrationInfo(96, 96, 2.0), favicon_data_192
40+
) # 192x192 PNG (96*2)
4641

4742
# Non-square illustrations
48-
c.add_illustration(IllustrationInfo(128, 64, 1.0), favicon_data)
49-
c.add_illustration(IllustrationInfo(64, 128, 1.0), favicon_data)
43+
c.add_illustration(IllustrationInfo(128, 64, 1.0), favicon_data_128_64)
44+
c.add_illustration(IllustrationInfo(64, 128, 1.0), favicon_data_64_128)
5045

5146
# Large illustration
52-
c.add_illustration(IllustrationInfo(256, 256, 1.0), favicon_data)
47+
c.add_illustration(IllustrationInfo(256, 256, 1.0), favicon_data_256)
5348

5449
return fpath
5550

@@ -169,29 +164,51 @@ class TestArchiveGetIllustrationItem:
169164
"""Test Archive.get_illustration_item() with IllustrationInfo."""
170165

171166
def test_get_illustration_item_with_info(
172-
self, zim_with_varied_illustrations, favicon_data
167+
self,
168+
zim_with_varied_illustrations,
169+
favicon_data_48,
170+
favicon_data_96,
171+
favicon_data_144,
172+
favicon_data_192,
173+
favicon_data_128_64,
174+
favicon_data_64_128,
175+
favicon_data_256,
173176
):
174177
"""Test getting illustration item using IllustrationInfo."""
175178
zim = Archive(zim_with_varied_illustrations)
176179
infos = zim.get_illustration_infos()
177180

181+
# Map (width, height, scale) to expected PNG data
182+
# Physical pixels = CSS pixels * scale
183+
expected_data = {
184+
(48, 48, 1.0): favicon_data_48, # 48x48 PNG
185+
(48, 48, 2.0): favicon_data_96, # 96x96 PNG (48*2)
186+
(48, 48, 3.0): favicon_data_144, # 144x144 PNG (48*3)
187+
(96, 96, 1.0): favicon_data_96, # 96x96 PNG
188+
(96, 96, 2.0): favicon_data_192, # 192x192 PNG (96*2)
189+
(128, 64, 1.0): favicon_data_128_64, # 128x64 PNG
190+
(64, 128, 1.0): favicon_data_64_128, # 64x128 PNG
191+
(256, 256, 1.0): favicon_data_256, # 256x256 PNG
192+
}
193+
178194
# Get item for each illustration
179195
for info in infos:
180-
item = zim.get_illustration_item(info=info)
181-
assert bytes(item.content) == favicon_data
196+
item = zim.get_illustration_item(info)
197+
expected = expected_data[(info.width, info.height, info.scale)]
198+
assert bytes(item.content) == expected
182199
# Verify path contains the illustration metadata name
183200
assert "Illustration" in item.path
184201

185202
def test_get_illustration_item_specific_scale(
186-
self, zim_with_varied_illustrations, favicon_data
203+
self, zim_with_varied_illustrations, favicon_data_96
187204
):
188205
"""Test getting specific scale illustration."""
189206
zim = Archive(zim_with_varied_illustrations)
190207

191-
# Get the 48x48@2 illustration specifically
208+
# Get the 48x48@2 illustration specifically (96x96 physical pixels)
192209
info = IllustrationInfo(48, 48, 2.0)
193-
item = zim.get_illustration_item(info=info)
194-
assert bytes(item.content) == favicon_data
210+
item = zim.get_illustration_item(info)
211+
assert bytes(item.content) == favicon_data_96
195212

196213
def test_get_illustration_item_nonexistent(self, zim_with_varied_illustrations):
197214
"""Test getting non-existent illustration raises error."""
@@ -200,20 +217,31 @@ def test_get_illustration_item_nonexistent(self, zim_with_varied_illustrations):
200217
# Try to get illustration that doesn't exist
201218
info = IllustrationInfo(999, 999, 1.0)
202219
with pytest.raises(KeyError):
203-
zim.get_illustration_item(info=info)
220+
zim.get_illustration_item(info)
221+
222+
def test_get_illustration_item_default(
223+
self, zim_with_varied_illustrations, favicon_data_48
224+
):
225+
"""Test that get_illustration_item() without argument defaults to size 48."""
226+
zim = Archive(zim_with_varied_illustrations)
227+
228+
# No argument should default to 48x48@1
229+
item = zim.get_illustration_item()
230+
assert bytes(item.content) == favicon_data_48
231+
assert "Illustration_48x48@1" in item.path
204232

205233
def test_get_illustration_item_old_api_still_works(
206-
self, zim_with_varied_illustrations, favicon_data
234+
self, zim_with_varied_illustrations, favicon_data_48, favicon_data_96
207235
):
208236
"""Test that old API (size parameter) still works."""
209237
zim = Archive(zim_with_varied_illustrations)
210238

211239
# Old API with size should work for @1 scale illustrations
212-
item = zim.get_illustration_item(size=48)
213-
assert bytes(item.content) == favicon_data
240+
item = zim.get_illustration_item(48)
241+
assert bytes(item.content) == favicon_data_48
214242

215-
item = zim.get_illustration_item(size=96)
216-
assert bytes(item.content) == favicon_data
243+
item = zim.get_illustration_item(96)
244+
assert bytes(item.content) == favicon_data_96
217245

218246

219247
class TestDeprecationWarnings:

0 commit comments

Comments
 (0)