typing.Protocol for 'anything with these methods'
A function that takes a Repository should accept anything that has get and save, including the fake in the test, without the fake inheriting from anything.
class Repository(Protocol):
def get(self, id: str) -> Order | None: ...
def save(self, order: Order) -> None: ...Structural, checked by the type checker, no base class needed. It is how duck typing and static types stop fighting.
python