ComicTagger now accounts for any single unicode numeric value
This commit is contained in:
lordwelch 2022-05-14 01:57:28 -07:00
parent a4cb8b51a6
commit 9a9d97f3bb
2 changed files with 4 additions and 3 deletions

View File

@ -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

View File

@ -3,6 +3,7 @@ import pytest
import comicapi.issuestring
issues = [
("¼", 0.25),
("", 1.5),
("0.5", 0.5),
("0", 0.0),