Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/balderhub/data/lib/utils/single_data_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
17 changes: 17 additions & 0 deletions tests/scenarios/scenario_utils_single_data_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading