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

Method test_find_through_ElementTree

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

Source from the content-addressed store, hash-verified

3587 e.findall('/tag')
3588
3589 def test_find_through_ElementTree(self):
3590 e = ET.XML(SAMPLE_XML)
3591 self.assertEqual(ET.ElementTree(e).find('tag').tag, 'tag')
3592 self.assertEqual(ET.ElementTree(e).findtext('tag'), 'text')
3593 self.assertEqual(summarize_list(ET.ElementTree(e).findall('tag')),
3594 ['tag'] * 2)
3595 # this produces a warning
3596 msg = ("This search is broken in 1.3 and earlier, and will be fixed "
3597 "in a future version. If you rely on the current behaviour, "
3598 "change it to '.+'")
3599 with self.assertWarnsRegex(FutureWarning, msg):
3600 it = ET.ElementTree(e).findall('//tag')
3601 self.assertEqual(summarize_list(it), ['tag'] * 3)
3602
3603
3604class ElementIterTest(unittest.TestCase):

Callers

nothing calls this directly

Calls 6

summarize_listFunction · 0.85
assertWarnsRegexMethod · 0.80
assertEqualMethod · 0.45
findMethod · 0.45
findtextMethod · 0.45
findallMethod · 0.45

Tested by

no test coverage detected