def test_yaml_to_xml_to_yaml(self): _source_fmt = 'yaml' _target_fmt = 'xml' with open(os.path.join(test_resources, 'good.%s' % _source_fmt), 'r') as _a: _a_seria = seria.load(_a) _b = StringIO() _b.write(_a_seria.dump(fmt=_target_fmt)) _b_seria = seria.load(_b) _c = StringIO() _c.write(_b_seria.dump(fmt=_source_fmt)) _a.seek(0) _c.seek(0) assert _a.read() == _c.read()
def test_xml_to_json_to_xml(self): _source_fmt = 'xml' _target_fmt = 'json' with open(os.path.join(test_resources, 'good.%s' % _source_fmt), 'r') as _a: _a_seria = seria.load(_a) _b = StringIO() _b.write(_a_seria.dump(fmt=_target_fmt)) _b_seria = seria.load(_b) _c = StringIO() _c.write(_b_seria.dump(fmt=_source_fmt, pretty=True, newl='\n', indent=' ')) _c.seek(0) _a.seek(0) assert _a.read() == _c.read()
def test_xml_to_json_to_xml(self): _source_fmt = 'xml' _target_fmt = 'json' with open(os.path.join(test_resources, 'good.%s' % _source_fmt), 'r') as _a: _a_seria = seria.load(_a) _b = StringIO() _b.write(_a_seria.dump(fmt=_target_fmt)) _b_seria = seria.load(_b) _c = StringIO() _c.write( _b_seria.dump(fmt=_source_fmt, pretty=True, newl='\n', indent=' ')) _c.seek(0) _a.seek(0) assert _a.read() == _c.read()