diff --git a/src/logic/metadataHandlers.py b/src/logic/metadataHandlers.py index 4a69219..b79e217 100644 --- a/src/logic/metadataHandlers.py +++ b/src/logic/metadataHandlers.py @@ -55,7 +55,9 @@ def description(metadata: Manga) -> str: desc = metadata.description if desc: desc = desc.split("\n

\n(")[0] + desc = desc.split("\n

\n")[0] desc = desc.replace("
", "") + desc = desc.replace("
", "") return desc return metadata.description diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_manga.py b/tests/test_manga.py new file mode 100644 index 0000000..5b925a4 --- /dev/null +++ b/tests/test_manga.py @@ -0,0 +1,55 @@ +import pytest + +from anilistapi.schemas.manga import Manga + +testmanga = { + "id": 107134, + "title": { + "romaji": "Nanatsu no Maken ga Shihai Suru", + "english": "Reign of the Seven Spellblades", + "native": "七つの魔剣が支配する", + }, + "type": "MANGA", + "format": "MANGA", + "synonyms": ["Seven Magic Swords Rule", "Nanatsuma", "ななつま"], + "status": "FINISHED", + "genres": ["Action", "Fantasy"], + "tags": [ + {"name": "Shounen", "isAdult": False}, + {"name": "School", "isAdult": False}, + {"name": "Magic", "isAdult": False}, + {"name": "Swordplay", "isAdult": False}, + ], + "description": "It’s springtime at Kimberly Magic Academy, and that means the arrival of a fresh crop of first-year students. Whether it’s the quiet and studious Oliver Horn or Nanao Hibiya, a samurai girl from a distant land, they come with wands and swords at their waists, ready to take their first steps on the road to magical mastery. However, beneath its brilliant facade of cherry blossoms, the academy hides countless dangers and dark secrets, ready to take the lives of the unprepared…!\n

\n(Source: Yen Press) ", + "coverImage": { + "large": "https://s4.anilist.co/file/anilistcdn/media/manga/cover/medium/bx107134-VJ3gvvxKTvec.jpg" + }, + "isAdult": False, + "chapters": 46, + "volumes": 8, + "externalLinks": [ + { + "site": "ComicWalker", + "url": "https://comic-walker.com/contents/detail/KDCW_KS01201140010000_68/", + "type": "STREAMING", + }, + { + "site": "Yen Press", + "url": "https://yenpress.com/series/reign-of-the-seven-spellblades-manga", + "type": "INFO", + }, + { + "site": "Web Ace", + "url": "https://web-ace.jp/shonenace/contents/397/", + "type": "STREAMING", + }, + ], + "countryOfOrigin": "JP", +} + + +def test_manga(): + manga = Manga(**testmanga) + assert manga.id == 107134 + assert manga.isManga is True + assert manga.isLightNovel is False