def _build_child_objects(cls, data: dict, session: Session = None): """ Build the condition and parameter templates and bounds. Parameters ---------- data: dict A serialized material template. session: Session, optional Citrine session used to connect to the database. Returns ------- None The serialized process template is modified so that its conditions are now a list of object pairs of the form [ConditionTemplate, :py:class:`BaseBounds <taurus.entity.bounds.base_bounds.BaseBounds>`], and the parameters are [ParameterTemplate, :py:class:`BaseBounds <taurus.entity.bounds.base_bounds.BaseBounds>`]. """ if 'conditions' in data and len(data['conditions']) != 0: data['conditions'] = [[ ConditionTemplate.build(cond[0].as_dict()), loads(dumps(cond[1])) ] for cond in data['conditions']] if 'parameters' in data and len(data['parameters']) != 0: data['parameters'] = [[ ParameterTemplate.build(param[0].as_dict()), loads(dumps(param[1])) ] for param in data['parameters']]
def test_parameter_template(): """Test creation and serde of parameter templates.""" bounds = IntegerBounds(-3, 8) template = ParameterTemplate("Position knob", bounds=bounds, tags=["Tag1", "A::B::C"]) assert template.uids is not None # uids should be added automatically assert ParameterTemplate.build(template.dump()) == template