Skip to content

Commit dd7f88b

Browse files
committed
fix(components_base): fix components base tests
Changed the special handling for list/dict types to: Use logging_warning instead of logging_error Call self._process_value(path, str(value) if value is not None else None) to return the original value, matching the test expectations
1 parent f182b69 commit dd7f88b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

ardupilot_methodic_configurator/data_model_vehicle_components_base.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,14 @@ def _safe_cast_value( # noqa: PLR0911 pylint: disable=too-many-return-statement
158158
# Special handling for list/dict types
159159
if datatype in (list, dict):
160160
type_name = getattr(datatype, "__name__", repr(datatype))
161-
logging_error(_("Invalid value '%s' for datatype %s at path %s"), value, type_name, path)
162-
return ""
161+
logging_warning(
162+
_("Failed to cast value '%s' to %s for path %s: %s"),
163+
value,
164+
type_name,
165+
path,
166+
"list and dict types require structured data",
167+
)
168+
return self._process_value(path, str(value) if value is not None else None)
163169

164170
# Standard type conversion
165171
return datatype(value)

0 commit comments

Comments
 (0)