Skip to content

Commit cfac438

Browse files
committed
Support AZW files in MOBI handler
1 parent 97ef669 commit cfac438

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

bookworm/document/formats/mobi.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class MobiDocument(DummyDocument):
3939
name = _("Kindle eBook")
4040
extensions = (
4141
"*.mobi",
42+
"*.azw",
4243
"*.azw3",
4344
)
4445
capabilities = DC.ASYNC_READ

tests/test_document_uri.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,9 @@ def test_uri_from_filename(asset):
1515
parsed_uri = uri.from_uri_string(as_str)
1616
assert uri.path == parsed_uri.path
1717
assert uri == parsed_uri
18+
19+
20+
@pytest.mark.parametrize("filename", ("sample.mobi", "sample.azw", "sample.azw3"))
21+
def test_uri_from_filename_recognizes_mobi_family(filename):
22+
uri = DocumentUri.from_filename(filename)
23+
assert uri.format == "mobi"

0 commit comments

Comments
 (0)