parent
a4cb8b51a6
commit
9a9d97f3bb
@ -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
|
||||
|
@ -3,6 +3,7 @@ import pytest
|
||||
import comicapi.issuestring
|
||||
|
||||
issues = [
|
||||
("¼", 0.25),
|
||||
("1½", 1.5),
|
||||
("0.5", 0.5),
|
||||
("0", 0.0),
|
||||
|
Loading…
Reference in New Issue
Block a user