def test_substitute(): """Test we can substitute.""" assert substitute(Input("hello"), {"hello": 5}) == 5 with pytest.raises(UndefinedSubstitution): substitute(Input("hello"), {}) assert ( substitute( {"info": [1, Input("hello"), 2, Input("world")]}, {"hello": 5, "world": 10}, ) == {"info": [1, 5, 2, 10]} )
def async_substitute(self) -> dict: """Get the blueprint value with the inputs substituted.""" processed = yaml.substitute(self.blueprint.data, self.inputs_with_default) combined = {**processed, **self.config_with_inputs} # From config_with_inputs combined.pop(CONF_USE_BLUEPRINT) # From blueprint combined.pop(CONF_BLUEPRINT) return combined