コード例 #1
0
def test_canonical_parser(canonical_filename, verbose=False):
    data = open(canonical_filename, 'rb').read()
    events = list(yaml.canonical_parse(data))
    assert events, events
    if verbose:
        for event in events:
            print event
コード例 #2
0
def test_parser_on_canonical(canonical_filename, verbose=False):
    events1 = None
    events2 = None
    try:
        events1 = list(yaml.parse(open(canonical_filename, 'rb')))
        events2 = list(yaml.canonical_parse(open(canonical_filename, 'rb')))
        _compare_events(events1, events2, full=True)
    finally:
        if verbose:
            print "EVENTS1:"
            pprint.pprint(events1)
            print "EVENTS2:"
            pprint.pprint(events2)