Merge branch 'feature/149-add-tests' into develop
This commit is contained in:
commit
f3095144f5
@ -30,8 +30,9 @@ import py7zr
|
||||
|
||||
try:
|
||||
from unrar.cffi import rarfile
|
||||
rar_support = True
|
||||
except:
|
||||
pass
|
||||
rar_support = True
|
||||
|
||||
try:
|
||||
from PIL import Image
|
||||
@ -879,7 +880,7 @@ class ComicArchive:
|
||||
self.page_list = []
|
||||
for name in files:
|
||||
if (
|
||||
os.path.splitext(name)[1].lower() in [".jpg", "jpeg", ".png", ".gif", ".webp"]
|
||||
os.path.splitext(name)[1].lower() in [".jpg", ".jpeg", ".png", ".gif", ".webp"]
|
||||
and os.path.basename(name)[0] != "."
|
||||
):
|
||||
self.page_list.append(name)
|
||||
|
@ -6,3 +6,4 @@ black>=22
|
||||
flake8==4.*
|
||||
flake8-encodings
|
||||
isort>=5.10
|
||||
pytest==7.*
|
BIN
tests/data/fake_cbr.cbr
Normal file
BIN
tests/data/fake_cbr.cbr
Normal file
Binary file not shown.
21
tests/test_comicarchive.py
Normal file
21
tests/test_comicarchive.py
Normal file
@ -0,0 +1,21 @@
|
||||
from os.path import abspath, dirname, join
|
||||
|
||||
from comicapi.comicarchive import ComicArchive, rar_support
|
||||
import pytest
|
||||
|
||||
thisdir = dirname(abspath(__file__))
|
||||
|
||||
@pytest.mark.xfail("rar_support")
|
||||
def test_getPageNameList():
|
||||
ComicArchive.logo_data = b""
|
||||
c = ComicArchive(join(thisdir, "data", "fake_cbr.cbr"))
|
||||
pageNameList = c.get_page_name_list()
|
||||
|
||||
assert pageNameList == [
|
||||
"page0.jpg",
|
||||
"Page1.jpeg",
|
||||
"Page2.png",
|
||||
"Page3.gif",
|
||||
"page4.webp",
|
||||
"page10.jpg",
|
||||
]
|
Loading…
Reference in New Issue
Block a user