Restore test cbz

Add test to ensure that metadata is read correctly
Add tests for IssueString
This commit is contained in:
lordwelch 2022-05-14 01:59:39 -07:00
parent 1bbdebff42
commit a4cb8b51a6
4 changed files with 36 additions and 7 deletions

View File

@ -383,12 +383,12 @@ md_test.characters = "Anda"
md_test.teams = "Fahrenheit"
md_test.locations = "lonely cottage "
md_test.credits = [
{"person": "Dara Naraghi", "role": "Writer"},
{"person": "Esteve Polls", "role": "Penciller"},
{"person": "Esteve Polls", "role": "Inker"},
{"person": "Neil Uyetake", "role": "Letterer"},
{"person": "Sam Kieth", "role": "Cover"},
{"person": "Ted Adams", "role": "Editor"},
CreditMetadata({"primary": False, "person": "Dara Naraghi", "role": "Writer"}),
CreditMetadata({"primary": False, "person": "Esteve Polls", "role": "Penciller"}),
CreditMetadata({"primary": False, "person": "Esteve Polls", "role": "Inker"}),
CreditMetadata({"primary": False, "person": "Neil Uyetake", "role": "Letterer"}),
CreditMetadata({"primary": False, "person": "Sam Kieth", "role": "Cover"}),
CreditMetadata({"primary": False, "person": "Ted Adams", "role": "Editor"}),
]
md_test.tags = []
md_test.pages = [
@ -417,7 +417,7 @@ md_test.pages = [
{"Image": 22, "ImageHeight": "2039", "ImageSize": "675078", "ImageWidth": "1326"},
{
"Bookmark": "Interview",
"Image": "23",
"Image": 23,
"ImageHeight": "2032",
"ImageSize": "800965",
"ImageWidth": "1338",

19
tests/issuestring_test.py Normal file
View File

@ -0,0 +1,19 @@
import pytest
import comicapi.issuestring
issues = [
("", 1.5),
("0.5", 0.5),
("0", 0.0),
("1", 1.0),
("22.BEY", 22.0),
("22A", 22.0),
("22-A", 22.0),
]
@pytest.mark.parametrize("issue, expected", issues)
def test_issue_string_as_float(issue, expected):
issue_float = comicapi.issuestring.IssueString(issue).as_float()
assert issue_float == expected

View File

@ -42,6 +42,16 @@ def test_page_type_read():
assert isinstance(md.pages[0]["Type"], str)
def test_metadat_read():
c = ComicArchive(
join(thisdir, "data", "Cory Doctorow's Futuristic Tales of the Here and Now #001 - Anda's Game (2007).cbz")
)
md = c.read_cix()
md_dict = md.__dict__
md_test_dict = md_test.__dict__
assert md_dict == md_test_dict
def test_save_cix(tmpdir):
comic_path = tmpdir.mkdir("cbz").join(
"Cory Doctorow's Futuristic Tales of the Here and Now #001 - Anda's Game (2007).cbz"