MCPcopy Index your code
hub / github.com/python/cpython / test_bug_xmltoolkit21

Method test_bug_xmltoolkit21

Lib/test/test_xml_etree.py:2229–2255  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2227class BugsTest(unittest.TestCase):
2228
2229 def test_bug_xmltoolkit21(self):
2230 # marshaller gives obscure errors for non-string values
2231
2232 def check(elem):
2233 with self.assertRaises(TypeError) as cm:
2234 serialize(elem)
2235 self.assertEqual(str(cm.exception),
2236 'cannot serialize 123 (type int)')
2237
2238 elem = ET.Element(123)
2239 check(elem) # tag
2240
2241 elem = ET.Element("elem")
2242 elem.text = 123
2243 check(elem) # text
2244
2245 elem = ET.Element("elem")
2246 elem.tail = 123
2247 check(elem) # tail
2248
2249 elem = ET.Element("elem")
2250 elem.set(123, "123")
2251 check(elem) # attribute key
2252
2253 elem = ET.Element("elem")
2254 elem.set("123", 123)
2255 check(elem) # attribute value
2256
2257 def test_bug_xmltoolkit25(self):
2258 # typo in ElementTree.findtext

Callers

nothing calls this directly

Calls 2

setMethod · 0.95
checkFunction · 0.70

Tested by

no test coverage detected