def test_attrib_dict(self):
ElementTree = self.etree.ElementTree
f = BytesIO('<doc one="One" two="Two"/>')
doc = ElementTree(file=f)
root = doc.getroot()
attrib = dict(root.attrib)
self.assertEqual('One', attrib['one'])
self.assertEqual('Two', attrib['two'])
self.assertRaises(KeyError, operator.getitem, attrib, 'three')
评论列表
文章目录