diff --git a/tests/sources/musq/test_proto.py b/tests/sources/musq/test_proto.py index 57fef46d..1f72edb1 100644 --- a/tests/sources/musq/test_proto.py +++ b/tests/sources/musq/test_proto.py @@ -54,23 +54,23 @@ class TestChapterView(Fixtureable[ChapterViewer]): def process(self, source: Path): return _proto_read(source, ChapterViewer) - def assertion_test(self, chapter_view: ChapterViewer): - assert chapter_view.status == 0 - - assert chapter_view.user_point.free == 0 - assert chapter_view.user_point.event == 0 - assert chapter_view.user_point.paid == 480 - assert chapter_view.user_point.total_point == 480 - assert len(chapter_view.images) == 11 - assert chapter_view.previous_chapter is None - assert chapter_view.next_chapter is not None - - image = chapter_view.images[0] + def assertion_test(self, result: ChapterViewer): + assert result.status == 0 + + assert result.user_point.free == 0 + assert result.user_point.event == 0 + assert result.user_point.paid == 480 + assert result.user_point.total_point == 480 + assert len(result.images) == 11 + assert result.previous_chapter is None + assert result.next_chapter is not None + + image = result.images[0] assert image.filename == "1.avif" assert image.stem == "1" assert image.extension == "avif" - image2 = chapter_view.images[1] + image2 = result.images[1] image2.url = "/data/1/noextension" assert image2.extension == "" @@ -81,18 +81,18 @@ class TestChapterViewV2(Fixtureable[ChapterViewerV2]): def process(self, source: Path): return _proto_read(source, ChapterViewerV2) - def assertion_test(self, chapter_view: ChapterViewerV2): - assert chapter_view.status == 0 + def assertion_test(self, result: ChapterViewerV2): + assert result.status == 0 - assert chapter_view.user_point.free == 40 - assert chapter_view.user_point.event == 0 - assert chapter_view.user_point.paid == 370 - assert chapter_view.user_point.total_point == 410 - assert len(chapter_view.blocks) == 1 + assert result.user_point.free == 40 + assert result.user_point.event == 0 + assert result.user_point.paid == 370 + assert result.user_point.total_point == 410 + assert len(result.blocks) == 1 - assert chapter_view.next_chapter is not None + assert result.next_chapter is not None - block = chapter_view.blocks[0] + block = result.blocks[0] assert block.title == "Chapter 10.1" image = block.images[0] assert image.filename == "1.avif" diff --git a/tosho_mango/cli/base.py b/tosho_mango/cli/base.py index dbb64bf8..a25f846f 100644 --- a/tosho_mango/cli/base.py +++ b/tosho_mango/cli/base.py @@ -27,7 +27,7 @@ import sys import traceback from functools import partial -from typing import TYPE_CHECKING, Callable, List, Optional, Tuple, Union, cast +from typing import IO, TYPE_CHECKING, Any, Callable, List, Optional, Tuple, Union, cast import click from click.core import Context @@ -99,7 +99,7 @@ def __init__(self, message, exc_info): super().__init__(message) self.exc_info = exc_info - def show(self): + def show(self, file: IO[Any] | None = None): """Show the error message and traceback.""" emoji = "" if console.is_advanced(): diff --git a/tosho_mango/sources/kmkc/client.py b/tosho_mango/sources/kmkc/client.py index 40292e96..6d4ab285 100644 --- a/tosho_mango/sources/kmkc/client.py +++ b/tosho_mango/sources/kmkc/client.py @@ -87,7 +87,7 @@ class KMClientBase: API_HOST = b64decode("aHR0cHM6Ly9hcGkua21hbmdhLmtvZGFuc2hhLmNvbQ==").decode("utf-8") CDN_HOST = b64decode("aHR0cHM6Ly9jZG4ua21hbmdhLmtvZGFuc2hhLmNvbQ==").decode("utf-8") - _config: KMConfigWeb | KMConfigMobile + _config: KMConfigWeb | KMConfigMobile # type: ignore def __init__(self, config: KMConfigWeb | KMConfigMobile) -> None: self._config = config @@ -287,7 +287,7 @@ class KMClientWeb(KMClientBase): API_HOST = b64decode("aHR0cHM6Ly9hcGkua21hbmdhLmtvZGFuc2hhLmNvbQ==").decode("utf-8") CDN_HOST = b64decode("aHR0cHM6Ly9jZG4ua21hbmdhLmtvZGFuc2hhLmNvbQ==").decode("utf-8") - _config: KMConfigWeb + _config: KMConfigWeb # type: ignore def __init__(self, config: KMConfigWeb) -> None: super().__init__(config)