예제 #1
0
def test_implicit_resolver(data_filename, detect_filename, verbose=False):
    correct_tag = None
    node = None
    try:
        correct_tag = open(detect_filename, 'rb').read().strip()
        node = yaml.compose(open(data_filename, 'rb'))
        assert isinstance(node, yaml.SequenceNode), node
        for scalar in node.value:
            assert isinstance(scalar, yaml.ScalarNode), scalar
            assert scalar.tag == correct_tag, (scalar.tag, correct_tag)
    finally:
        if verbose:
            print "CORRECT TAG:", correct_tag
            if hasattr(node, 'value'):
                print "CHILDREN:"
                pprint.pprint(node.value)
예제 #2
0
def canonical_compose(stream):
    return yaml.compose(stream, Loader=CanonicalLoader)