Skip to content

Commit

Permalink
Merge pull request #1 from manga109/test-chara-ids
Browse files Browse the repository at this point in the history
test character ids
  • Loading branch information
kktsubota authored Feb 25, 2022
2 parents d9c6c43 + f64d0d0 commit 50cc8ec
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion manga109tools/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.1.0"
__version__ = "0.1.1"
14 changes: 14 additions & 0 deletions manga109tools/tests/test_xml_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,20 @@ def test_duplicate_id(self, annotations: list) -> None:

assert len(ids) == len(set(ids))

def test_chara_id(self, annotations: list) -> None:
"""The character id of faces and bodies should be pre-defined in characters.
Args:
annotations (list): list of annotation per book obtained by a manga109 parser
"""
for annotation in annotations:
chara_ids: set = {character["@id"] for character in annotation["character"]}

for page in annotation["page"]:
for annotation_tag in {"face", "body"}:
for element in page[annotation_tag]:
assert element["@character"] in chara_ids

def test_id_type(self, annotations: list) -> None:
"""Ids are hexadecimal with eight digits.
Expand Down

0 comments on commit 50cc8ec

Please sign in to comment.