diff --git a/src/balderhub/data/lib/utils/single_data_item.py b/src/balderhub/data/lib/utils/single_data_item.py index 694605e..68b4052 100644 --- a/src/balderhub/data/lib/utils/single_data_item.py +++ b/src/balderhub/data/lib/utils/single_data_item.py @@ -613,7 +613,12 @@ def needs_to_be_checked(self_val, other_val): # a sub SingleDataItem was expected and make sure that it is one if issubclass(inner_type, SingleDataItem) and isinstance(cur_self_item, SingleDataItem): - error_list.extend(cur_self_item.get_difference_error_messages(cur_other_item)) + error_list.extend(cur_self_item.get_difference_error_messages( + cur_other_item, + allow_non_definable=allow_non_definable, + validate_unique_identification_separately=validate_unique_identification_separately + # TODO also support excluded fields here + )) continue # normal item -> compare values if cur_self_item != cur_other_item: diff --git a/tests/scenarios/scenario_utils_single_data_item.py b/tests/scenarios/scenario_utils_single_data_item.py index 138cfc0..cfc2f7f 100644 --- a/tests/scenarios/scenario_utils_single_data_item.py +++ b/tests/scenarios/scenario_utils_single_data_item.py @@ -222,6 +222,23 @@ def test_get_field_value_not_definable(self): item = SimpleDataItem.create_non_definable(nested=True) assert item.get_field_value("name") == NOT_DEFINABLE + def test_compare_list_with_non_definable_elems(self): + item = ListDataItem(items=[], nested_items=[ + SimpleDataItem(name="test", value=42), + SimpleDataItem(name="test", value=99), + ]) + item2 = ListDataItem(items=[], nested_items=[ + SimpleDataItem(name="test", value=NOT_DEFINABLE), + SimpleDataItem(name="test", value=99), + ]) + + compare_error_msgs = item.get_difference_error_messages( + item2, + allow_non_definable=True, + validate_unique_identification_separately=False + ) + assert compare_error_msgs == [], compare_error_msgs + def test_get_field_value_missing_raises_key_error(self): item = SimpleDataItem.create_as_nested(name="test", value=42) try: