Ejemplo n.º 1
0
def test_canonical_parser(canonical_filename, verbose=False):
    with open(canonical_filename, 'rb') as fp0:
        data = fp0.read()
    events = list(ruyaml.canonical_parse(data))
    assert events, events
    if verbose:
        for event in events:
            print(event)
Ejemplo n.º 2
0
def test_parser(data_filename, canonical_filename, verbose=False):
    events1 = None
    events2 = None
    try:
        with open(data_filename, 'rb') as fp0:
            events1 = list(yaml.parse(fp0))
        with open(canonical_filename, 'rb') as fp0:
            events2 = list(yaml.canonical_parse(fp0))
        _compare_events(events1, events2)
    finally:
        if verbose:
            print('EVENTS1:')
            pprint.pprint(events1)
            print('EVENTS2:')
            pprint.pprint(events2)