
Both @jlowdermilk and I have tried to use this for initial configuration work. It's cheaper just to import it for now: Name: PyYAML Version: 3.11 Summary: YAML parser and emitter for Python Home-page: http://pyyaml.org/wiki/PyYAML Author: Kirill Simonov Author-email: xi@resolvent.net License: MIT Download-URL: http://pyyaml.org/download/pyyaml/PyYAML-3.11.tar.gz Description: YAML is a data serialization format designed for human readability and interaction with scripting languages. PyYAML is a YAML parser and emitter for Python. PyYAML features a complete YAML 1.1 parser, Unicode support, pickle support, capable extension API, and sensible error messages. PyYAML supports standard YAML tags and provides Python-specific tags that allow to represent an arbitrary Python object. PyYAML is applicable for a broad range of tasks from complex configuration files to object serialization and persistance.
41 lines
1.1 KiB
Python
41 lines
1.1 KiB
Python
|
|
import yaml, canonical
|
|
|
|
def test_canonical_scanner(canonical_filename, verbose=False):
|
|
data = open(canonical_filename, 'rb').read()
|
|
tokens = list(yaml.canonical_scan(data))
|
|
assert tokens, tokens
|
|
if verbose:
|
|
for token in tokens:
|
|
print(token)
|
|
|
|
test_canonical_scanner.unittest = ['.canonical']
|
|
|
|
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)
|
|
|
|
test_canonical_parser.unittest = ['.canonical']
|
|
|
|
def test_canonical_error(data_filename, canonical_filename, verbose=False):
|
|
data = open(data_filename, 'rb').read()
|
|
try:
|
|
output = list(yaml.canonical_load_all(data))
|
|
except yaml.YAMLError as exc:
|
|
if verbose:
|
|
print(exc)
|
|
else:
|
|
raise AssertionError("expected an exception")
|
|
|
|
test_canonical_error.unittest = ['.data', '.canonical']
|
|
test_canonical_error.skip = ['.empty']
|
|
|
|
if __name__ == '__main__':
|
|
import test_appliance
|
|
test_appliance.run(globals())
|
|
|