def test_to_dict(self): source_node = etree.XML(self.xml_file) user = User.parse(LXMLDocumentBuilder, source_node) self.assertEqual( User.build(PythonDocumentBuilder, user), { '_attributes': { 'first_name': 'Alexander', 'last_name': 'Pepyako', 'age': 23, 'gender': 'male', 'phone': '+79110010203', 'email': '*****@*****.**' }, 'id': 1, 'sign': 'Pepyako inc.' } )
def test_to_xml(self): source_node = etree.XML(self.xml_file) user = User.parse(LXMLDocumentBuilder, source_node) xml_node = User.build(LXMLDocumentBuilder, user) source = User.parse(LXMLDocumentBuilder, xml_node) self.assert_user(source)