def _yatiml_recognize(cls, node: yatiml.UnknownNode) -> None: node.require_attribute('name', str) node.require_attribute('age', Union[int, str])
def test_require_attribute(unknown_node: yatiml.UnknownNode) -> None: unknown_node.require_attribute('attr1') with pytest.raises(yatiml.RecognitionError): unknown_node.require_attribute('non_existent_attribute') unknown_node.require_attribute('attr1', int) with pytest.raises(yatiml.RecognitionError): unknown_node.require_attribute('attr1', str) unknown_node.require_attribute('null_attr', None) with pytest.raises(yatiml.RecognitionError): unknown_node.require_attribute('attr1', None) with pytest.raises(yatiml.RecognitionError): unknown_node.require_attribute('null_attr', int)
def _yatiml_recognize(cls, node: yatiml.UnknownNode) -> None: node.require_mapping() node.require_attribute('name') node.require_attribute('components')
def _yatiml_recognize(cls, node: yatiml.UnknownNode) -> None: node.require_attribute('model', Model) node.require_attribute('implementations') node.require_attribute('resources')
def _yatiml_recognize(cls, node: yatiml.UnknownNode) -> None: node.require_mapping() node.require_attribute('ymmsl_version') node.require_attribute_value('ymmsl_version', 'v0.1')