From f63448d49777a84fc091627159263c7180b8a58c Mon Sep 17 00:00:00 2001 From: Ivan Koldakov Date: Mon, 4 Mar 2024 22:16:48 +0100 Subject: [PATCH] Remove outdated method --- app/repositories/base.py | 9 --------- app/repositories/tests/test_base.py | 14 -------------- 2 files changed, 23 deletions(-) delete mode 100644 app/repositories/tests/test_base.py diff --git a/app/repositories/base.py b/app/repositories/base.py index 600adfd..ce94779 100644 --- a/app/repositories/base.py +++ b/app/repositories/base.py @@ -62,15 +62,6 @@ class Base(DeclarativeBase): default=uuid4, ) - def to_dict( - self, - *, - exclude: list[str] | None = None, - ) -> dict: - if exclude is None: - exclude = [] - return {k: v for k, v in self.__dict__.items() if not str(k).startswith("_") and str(k) not in exclude} - @classmethod async def get( cls, diff --git a/app/repositories/tests/test_base.py b/app/repositories/tests/test_base.py deleted file mode 100644 index a86f846..0000000 --- a/app/repositories/tests/test_base.py +++ /dev/null @@ -1,14 +0,0 @@ -from app.repositories.models import Character - - -class TestBase: - character = Character(id=1) - - def test_to_dict_should_return_dict_with_id_when_id_provided(self): - assert self.character.to_dict() == {"id": 1} - - def test_to_dict_should_return_empty_dict_when_id_provided_and_id_excluded(self): - assert self.character.to_dict(exclude=["id"]) == {} - - def test_to_dict_should_not_return__sa_instance_state_in_dict_when_requested(self): - assert "_sa_instance_state" not in self.character.to_dict()