def test_implicit_resolver(data_filename, detect_filename, verbose=False): correct_tag = None node = None try: with open(detect_filename, 'r') as fp0: correct_tag = fp0.read().strip() with open(data_filename, 'rb') as fp0: node = yaml.compose(fp0) 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)
def canonical_compose(stream): return ruyaml.compose(stream, Loader=CanonicalLoader)