Compare commits
2 Commits
1.4.4-alph
...
1.4.4-alph
Author | SHA1 | Date | |
---|---|---|---|
9a9d97f3bb | |||
a4cb8b51a6 |
@ -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",
|
||||
|
@ -21,6 +21,7 @@ comics industry throws at us.
|
||||
|
||||
|
||||
import logging
|
||||
import unicodedata
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -113,9 +114,8 @@ class IssueString:
|
||||
|
||||
def as_float(self):
|
||||
# return the float, with no suffix
|
||||
if self.suffix == "½":
|
||||
if self.num is not None:
|
||||
return self.num + 0.5
|
||||
if len(self.suffix) == 1 and self.suffix.isnumeric():
|
||||
return (self.num or 0) + unicodedata.numeric(self.suffix)
|
||||
|
||||
return 0.5
|
||||
return self.num
|
||||
|
Binary file not shown.
20
tests/issuestring_test.py
Normal file
20
tests/issuestring_test.py
Normal file
@ -0,0 +1,20 @@
|
||||
import pytest
|
||||
|
||||
import comicapi.issuestring
|
||||
|
||||
issues = [
|
||||
("¼", 0.25),
|
||||
("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
|
@ -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"
|
||||
|
Reference in New Issue
Block a user