示例#1
0
def test_set_value(class_node: yatiml.Node) -> None:
    assert class_node.is_mapping()
    class_node.set_value(42)
    assert class_node.is_scalar(int)
    assert class_node.yaml_node.value == '42'
    class_node.set_value(True)
    assert class_node.is_scalar(bool)
    assert class_node.yaml_node.value == 'true'
示例#2
0
def test_is_mapping(class_node: yatiml.Node) -> None:
    assert class_node.is_mapping()
    assert not class_node.get_attribute('attr1').is_mapping()
    assert not class_node.get_attribute('list1').is_mapping()