fuxed mypy issues
Code Quality Pipeline / code-quality (pull_request) Failing after 14s
Test Python Package / test (pull_request) Failing after 9s

This commit is contained in:
Brian Bjarke Jensen
2025-09-14 20:08:30 +02:00
parent 0948799653
commit 0e47db238a
4 changed files with 23 additions and 34 deletions
@@ -1,5 +1,6 @@
"""Integration tests for ContextAwareInterface."""
from __future__ import annotations
import pytest
from python_repositories.interfaces.context_aware_interface import ContextAwareInterface
@@ -14,26 +15,27 @@ def test_instantiation_fails_when_enter_not_implemented() -> None:
pass
with pytest.raises(TypeError):
_ = Incomplete()
_ = Incomplete() # type: ignore
def test_instantiation_fails_when_exit_not_implemented() -> None:
"""Test that instantiation fails if __exit__ is not implemented."""
class Incomplete(ContextAwareInterface):
"""A class that does not implement __exit__."""
def __enter__(self) -> ContextAwareInterface:
def __enter__(self) -> Incomplete:
return self
with pytest.raises(TypeError):
_ = Incomplete()
_ = Incomplete() # type: ignore
def test_enter_raises_not_implemented_if_not_overwritten() -> None:
"""Test that __enter__ raises NotImplementedError if not implemented."""
class Incomplete(ContextAwareInterface):
"""A class that does not implement __enter__."""
def __enter__(self) -> ContextAwareInterface:
super().__enter__()
def __enter__(self) -> Incomplete:
super().__enter__() # type: ignore
return self
def __exit__(
self, exc_type: type | None, exc_val: object | None, exc_tb: object | None
@@ -55,7 +57,7 @@ def test_exit_raises_not_implemented_if_not_overwritten() -> None:
def __exit__(
self, exc_type: type | None, exc_val: object | None, exc_tb: object | None
) -> None:
super().__exit__(exc_type, exc_val, exc_tb)
super().__exit__(exc_type, exc_val, exc_tb) # type: ignore
instance = Incomplete()
with pytest.raises(NotImplementedError):