From 354fbd26f7891141c96de57c3e21ce735e4df1a3 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Sat, 13 Jul 2024 13:42:52 +0200 Subject: [PATCH] Fix various issues in tests/helpers.py --- tests/helpers.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/helpers.py b/tests/helpers.py index d21d6c6..15cf800 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -70,7 +70,7 @@ class UnpropagatingMockMixin(Generic[T_Mock]): _mock_sealed: bool _extract_mock_name: Callable[[], str] - def _get_child_mock(self, **kwargs) -> T_Mock: + def _get_child_mock(self, **kwargs: object) -> T_Mock: """Make :attr:`.child_mock_type`` instances instead of instances of the same class. By default, this method creates a new mock instance of the same original class, and passes @@ -89,7 +89,7 @@ class UnpropagatingMockMixin(Generic[T_Mock]): return self.child_mock_type(**kwargs) -class CustomMockMixin(UnpropagatingMockMixin): +class CustomMockMixin(UnpropagatingMockMixin[T_Mock], Generic[T_Mock]): """Provides common functionality for our custom mock types. * Stops propagation of same ``spec_set`` restricted mock in child mocks @@ -99,7 +99,7 @@ class CustomMockMixin(UnpropagatingMockMixin): spec_set = None - def __init__(self, **kwargs): + def __init__(self, **kwargs: object): if "spec_set" in kwargs: self.spec_set = kwargs.pop("spec_set") - super().__init__(spec_set=self.spec_set, **kwargs) # type: ignore # Mixin class, this __init__ is valid + super().__init__(spec_set=self.spec_set, **kwargs) # pyright: ignore[reportCallIssue] # Mixin class, this __init__ is valid