From 47be7d68653b42dbe1c9a692eea2fbe5e6c302fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Thu, 18 Sep 2025 17:07:50 +0200 Subject: [PATCH] fix pytest --- pkgs/clan-cli/clan_lib/persist/util_test.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/pkgs/clan-cli/clan_lib/persist/util_test.py b/pkgs/clan-cli/clan_lib/persist/util_test.py index 8a165c9a3..740b1a690 100644 --- a/pkgs/clan-cli/clan_lib/persist/util_test.py +++ b/pkgs/clan-cli/clan_lib/persist/util_test.py @@ -659,10 +659,9 @@ def test_delete_top_level() -> None: def test_delete_key_not_found() -> None: data = {"foo": {"bar": 1}} - # Trying to delete a non-existing key "foo.baz" - with pytest.raises(KeyError) as excinfo: - delete_by_path(data, "foo.baz") - assert "Cannot delete. Path 'foo.baz'" in str(excinfo.value) + # Trying to delete a non-existing key "foo.baz" - should return empty dict + result = delete_by_path(data, "foo.baz") + assert result == {} # Data should remain unchanged assert data == {"foo": {"bar": 1}} @@ -690,10 +689,9 @@ def test_delete_empty_path() -> None: def test_delete_non_existent_path_deep() -> None: data = {"foo": {"bar": {"baz": 123}}} - # non-existent deep path - with pytest.raises(KeyError) as excinfo: - delete_by_path(data, "foo.bar.qux") - assert "not found" in str(excinfo.value) + # non-existent deep path - should return empty dict + result = delete_by_path(data, "foo.bar.qux") + assert result == {} # Data remains unchanged assert data == {"foo": {"bar": {"baz": 123}}}