Fix import of nomie numerical score values

This commit is contained in:
Marty Oehme 2021-12-07 09:32:26 +01:00
parent aa2aff4e17
commit b9c89155e3
Signed by: Marty
GPG key ID: B7538B8F50A1C800
3 changed files with 38 additions and 15 deletions

18
tests/test_nomiedata.py Normal file
View file

@ -0,0 +1,18 @@
from habitmove import nomiedata
def test_score_numerical_becomes_int():
sut = nomiedata.Tracker(label="Int checking", tag="isint", id="1337", score="-1")
assert type(sut.score) == int
def test_score_invalid_int_stays_string():
sut = nomiedata.Tracker(label="Int checking", tag="isint", id="1337", score="-1.3")
assert type(sut.score) == str
def test_score_string_stays_string():
sut = nomiedata.Tracker(
label="Int checking", tag="isint", id="1337", score="custom"
)
assert type(sut.score) == str