| def test_representer_types(code_filename, verbose=False): |
| test_constructor._make_objects() |
| for allow_unicode in [False, True]: |
| for encoding in ['utf-8', 'utf-16-be', 'utf-16-le']: |
| native1 = test_constructor._load_code(open(code_filename, 'rb').read()) |
| output = yaml.dump(native1, Dumper=test_constructor.MyDumper, |
| allow_unicode=allow_unicode, encoding=encoding) |
| native2 = yaml.load(output, Loader=test_constructor.MyLoader) |
| value1 = test_constructor._serialize_value(native1) |
| value2 = test_constructor._serialize_value(native2) |
| print("SERIALIZED NATIVE1:") |
| print("SERIALIZED NATIVE2:") |
| assert value1 == value2, (native1, native2) |
| test_representer_types.unittest = ['.code'] |
| if __name__ == '__main__': |
| test_appliance.run(globals()) |