Coverage for backend/django/idaes_factory/adapters/serialisation_rules.py: 88%
11 statements
« prev ^ index » next coverage.py v7.10.7, created at 2026-06-23 21:51 +0000
« prev ^ index » next coverage.py v7.10.7, created at 2026-06-23 21:51 +0000
1"""Shared rules for deciding whether object properties are serialised."""
4def is_group_enabled(model, ctx, prop_key: str) -> bool:
5 """Return whether a property group participates in the current solve build."""
7 group = model.schema.properties[prop_key].propertySetGroup
8 group_schema = model.schema.propertySetGroups.get(group)
9 if group_schema is None: 9 ↛ 10line 9 didn't jump to line 10 because the condition on line 9 was never true
10 return True
11 if group_schema.toggle:
12 toggle_property = ctx.get_property(model.properties, group_schema.toggle)
13 toggle_status = ctx.get_property_value(toggle_property).value
14 if toggle_status != True:
15 return False
16 return group != "dynamics" or ctx.is_dynamic()