diff --git a/comicapi/genericmetadata.py b/comicapi/genericmetadata.py index ad0b99b..dc0ddc4 100644 --- a/comicapi/genericmetadata.py +++ b/comicapi/genericmetadata.py @@ -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", diff --git a/tests/data/Cory Doctorow's Futuristic Tales of the Here and Now #001 - Anda's Game (2007).cbz b/tests/data/Cory Doctorow's Futuristic Tales of the Here and Now #001 - Anda's Game (2007).cbz index bc281e8..a228fd0 100644 Binary files a/tests/data/Cory Doctorow's Futuristic Tales of the Here and Now #001 - Anda's Game (2007).cbz and b/tests/data/Cory Doctorow's Futuristic Tales of the Here and Now #001 - Anda's Game (2007).cbz differ diff --git a/tests/issuestring_test.py b/tests/issuestring_test.py new file mode 100644 index 0000000..b423961 --- /dev/null +++ b/tests/issuestring_test.py @@ -0,0 +1,19 @@ +import pytest + +import comicapi.issuestring + +issues = [ + ("1½", 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 diff --git a/tests/test_comicarchive.py b/tests/test_comicarchive.py index 0339127..0a7a168 100644 --- a/tests/test_comicarchive.py +++ b/tests/test_comicarchive.py @@ -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"