Skip to content

Commit 03ac98b

Browse files
author
renaud gaudin
committed
Fixed #29: using default values on Creator init
1 parent 334c0e0 commit 03ac98b

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

libzim/writer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ class Creator:
135135
Zim file metadata
136136
"""
137137

138-
def __init__(self, filename, main_page, index_language, min_chunk_size):
138+
def __init__(self, filename, main_page, index_language="eng", min_chunk_size=2048):
139139
self._creatorWrapper = _Creator(filename, main_page, index_language, min_chunk_size)
140140
self.filename = filename
141141
self.main_page = main_page

tests/test_libzim.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,3 +184,11 @@ def test_double_close(tmpdir):
184184
creator.close()
185185
with pytest.raises(RuntimeError):
186186
creator.close()
187+
188+
189+
def test_default_creator_params(tmpdir):
190+
""" ensure we can init a Creator without specifying all params """
191+
creator = Creator(str(tmpdir / "test.zim"), "welcome")
192+
assert True # we could init the Creator without specifying other params
193+
assert creator.language == "eng"
194+
assert creator.main_page == "welcome"

0 commit comments

Comments
 (0)