Skip to content

Commit

Permalink
Fix comic ean field value (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
Naouak authored May 23, 2024
1 parent 7c36264 commit 21b3b19
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions marvelous/comic.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ def process_input(self, data, **kwargs):
if "diamondCode" in new_data:
new_data["diamondCode"] = str(new_data["diamondCode"])

if "ean" in new_data:
new_data["ean"] = str(new_data["ean"])

return new_data

@post_load
Expand Down
6 changes: 6 additions & 0 deletions tests/comic_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ def test_invalid_diamond_code(talker):
assert hulk.diamond_code == "0"


def test_invalid_ean(talker):
"""Sometimes Marvel API sends number for ean"""
hulk = talker.comics({"id": 17826}).comics[0]
assert hulk.ean == "0"


def test_upc_code(talker):
cable = talker.comics({"id": 95781}).comics[0]
assert cable.upc == "759606201991000111"
Binary file modified tests/testing_mock.sqlite
Binary file not shown.

0 comments on commit 21b3b19

Please sign in to comment.