Define split JSON and object repository ABCs, promote adapter methods to public CRUD, add example domain repositories, modernize interface stubs, and make the package installable for tests. Co-authored-by: Cursor <[email protected]>
35 lines
1.0 KiB
Python
35 lines
1.0 KiB
Python
"""Integration tests for ContextAwareInterface."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
from python_repositories.interfaces.context_aware_interface import ContextAwareInterface
|
|
|
|
|
|
def test_instantiation_fails_when_enter_not_implemented() -> None:
|
|
"""Test that instantiation fails if __enter__ is not implemented."""
|
|
|
|
class Incomplete(ContextAwareInterface):
|
|
"""A class that does not implement __enter__."""
|
|
|
|
def __exit__(
|
|
self, exc_type: type | None, exc_val: object | None, exc_tb: object | None
|
|
) -> None:
|
|
pass
|
|
|
|
with pytest.raises(TypeError):
|
|
_ = 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) -> Incomplete:
|
|
return self
|
|
|
|
with pytest.raises(TypeError):
|
|
_ = Incomplete() # type: ignore
|