From 97a70babf02bdcfe48af3cc293edc4eff09cf685 Mon Sep 17 00:00:00 2001 From: Wouter2devries Date: Fri, 20 Mar 2026 21:51:55 +0100 Subject: [PATCH] Updated tests to test the behaviour Removed the return boolean test as it already tests for both true and false. --- test/test_query.py | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/test/test_query.py b/test/test_query.py index 0a501da7c..c6515ce10 100644 --- a/test/test_query.py +++ b/test/test_query.py @@ -525,9 +525,19 @@ class TestHasCoverArtQuery: @pytest.fixture(scope="class") def lib(self, helper): - """Create test items.""" - helper.add_item(title="with_art") - helper.add_item(title="without_art") + item_with = helper.add_item_fixture() + item_with.title = "with_art" + + path_with = helper.create_mediafile_fixture(images=["jpg"]) + item_with["path"] = path_with + item_with.store() + + path_without = helper.create_mediafile_fixture(images=[]) + item_without = helper.add_item_fixture() + item_without.title = "without_art" + item_without["path"] = path_without + item_without.store() + return helper.lib def test_has_cover_art_getter_exists(self): @@ -536,8 +546,8 @@ class TestHasCoverArtQuery: assert "has_cover_art" in getters assert getters["has_cover_art"] == Item.has_cover_art - def test_has_cover_art_returns_boolean(self): - """Method always return boolean.""" - item = _common.item() - result = item.has_cover_art() - assert isinstance(result, bool) \ No newline at end of file + def test_query_true(self, lib): + assert {i.title for i in lib.items("has_cover_art:true")} == {"with_art"} + + def test_query_false(self, lib): + assert {i.title for i in lib.items("has_cover_art:false")} == {"without_art"} \ No newline at end of file