From e9e79956b5f695839ccad55238b5274b659a88e8 Mon Sep 17 00:00:00 2001 From: Martijn Govers Date: Mon, 21 Oct 2024 13:12:18 +0200 Subject: [PATCH] more code coverage Signed-off-by: Martijn Govers --- tests/unit/validation/test_errors.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/unit/validation/test_errors.py b/tests/unit/validation/test_errors.py index f4c980399..bb76d64bc 100644 --- a/tests/unit/validation/test_errors.py +++ b/tests/unit/validation/test_errors.py @@ -88,6 +88,22 @@ def test_invalid_id_error(): assert str(error) == "Field 'november' does not contain a valid oscar/papa id for 3 nodes." +def test_invalid_id_error_with_filters(): + error = InvalidIdError( + ComponentType.node, + field="november", + ids=[1, 2, 3], + ref_components=["oscar", "papa"], + filters={"foo": "bar", "baz": ComponentType.node}, + ) + assert error.component == "node" + assert error.field == "november" + assert error.ids == [1, 2, 3] + assert error.ref_components == ["oscar", "papa"] + assert error.filters_str == "(foo=bar, baz=node)" + assert str(error) == "Field 'november' does not contain a valid oscar/papa id for 3 nodes. (foo=bar, baz=node)" + + def test_comparison_error(): error = ComparisonError(component=ComponentType.node, field="romeo", ids=[1, 2, 3], ref_value=0) assert error.component == "node"