MCPcopy Create free account
hub / github.com/ActiveState/code / test1

Function test1

recipes/Python/576445_ElementTree_Wrapper/recipe-576445.py:209–220  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

207 self.append(elt)
208
209def test1():
210 class xmldict(dict):
211 def __xml__(self):
212 xml_elt = xml('dict')
213 for key in self:
214 xml_elt.append(xml('dictent',xml('key',str(key)),
215 xml('value',str(self[key]))))
216 return xml_elt
217
218 e = xmldict()
219 e['foo'] = 'bar'
220 assert repr(xml(e)) == "<dict><dictent><key>foo</key><value>bar</value></dictent></dict>"
221
222def test2():
223 xml_test_data = [[xml('html', xml('body', *xml('br').join(xml('span',text) for text in ['foo','bar','baz']))),

Callers 1

runtestsFunction · 0.70

Calls 2

xmldictClass · 0.85
xmlClass · 0.70

Tested by

no test coverage detected