def test_xml2dict_multiple_tags(self): """ Converting from lxml etree to python dict """ xml = E.root(E.entry(E.name("Hello World")), E.entry(E.name("Bye"))) expected_result = {"root": {"entry": [{"name": "Hello World"}, {"name": "Bye"}]}} result = xml2dict(xml) self.assertEquals(expected_result, result)
def test_xml2dict_simple(self): """ Converting from lxml etree to python dict """ xml = E.root(E.entry(E.name("Hello World"))) expected_result = {"root": {"entry": {"name": "Hello World"}}} result = xml2dict(xml) self.assertEquals(expected_result, result)