From dfdedd3d210a8c118a2989bec30c80904ea2e46e Mon Sep 17 00:00:00 2001 From: Sebastian Grabowski Date: Fri, 8 Mar 2024 08:14:27 +0100 Subject: [PATCH] Call constructor of SavedSearch directly in tests --- GTG/core/saved_searches.py | 5 ----- tests/core/test_saved_search.py | 8 ++++---- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/GTG/core/saved_searches.py b/GTG/core/saved_searches.py index da25e39bb..3140538c5 100644 --- a/GTG/core/saved_searches.py +++ b/GTG/core/saved_searches.py @@ -46,11 +46,6 @@ def __init__(self, id: UUID, name: str, query: str) -> None: super().__init__() - # TODO probably not needed - @classmethod - def create(cls, name: str, query: str) -> 'SavedSearch': - return cls(uuid4(), name, query) - @GObject.Property(type=str) def name(self) -> str: """Read only property.""" diff --git a/tests/core/test_saved_search.py b/tests/core/test_saved_search.py index 04c57185f..6311b7319 100644 --- a/tests/core/test_saved_search.py +++ b/tests/core/test_saved_search.py @@ -59,8 +59,8 @@ def test_remove_simple(self): def test_count(self): store = SavedSearchStore() - search = store.add(SavedSearch.create('Root search', '@tag')) - store.add(SavedSearch.create('Root search 2', '@tag2')) + search = store.add(SavedSearch(uuid4(), 'Root search', '@tag')) + store.add(SavedSearch(uuid4(), 'Root search 2', '@tag2')) self.assertEqual(store.count(), 2) store.remove(search.id) @@ -102,8 +102,8 @@ def test_xml_load_tree(self): def test_xml_write_simple(self): store = SavedSearchStore() - search1 = store.add(SavedSearch.create('Some @tag', 'Looking for some tag')) - search2 = store.add(SavedSearch.create('Some @other @tag', 'Looking for more')) + search1 = store.add(SavedSearch(uuid4(), 'Some @tag', 'Looking for some tag')) + search2 = store.add(SavedSearch(uuid4(), 'Some @other @tag', 'Looking for more')) xml_root = store.to_xml()