From dc40fc299f8a58eb173524074fa7f94c2533bea6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mose=20M=C3=BCller?= Date: Fri, 26 Apr 2024 09:49:27 +0200 Subject: [PATCH] adds test for failing get_object_by_path_parts --- tests/utils/test_helpers.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/utils/test_helpers.py b/tests/utils/test_helpers.py index 77ecac2..797c872 100644 --- a/tests/utils/test_helpers.py +++ b/tests/utils/test_helpers.py @@ -103,6 +103,11 @@ def test_get_object_by_path_parts(path_parts: list[str], expected: Any) -> None: assert get_object_by_path_parts(service_instance, path_parts) == expected +def test_get_object_by_path_parts_error(caplog: pytest.LogCaptureFixture) -> None: + assert get_object_by_path_parts(service_instance, ["non_existent_attr"]) is None + assert "Attribute 'non_existent_attr' does not exist in the object." in caplog.text + + @pytest.mark.parametrize( "attr_name, expected", [