diff options
author | Eli Bendersky <eliben@gmail.com> | 2013-08-04 00:48:41 (GMT) |
---|---|---|
committer | Eli Bendersky <eliben@gmail.com> | 2013-08-04 00:48:41 (GMT) |
commit | b9b6ce6f2c687092dfc99c912e52cdc32ae44c3d (patch) | |
tree | a920ff74d5db314fc8e28707071e76c40b77b97e /Lib/test | |
parent | 739e75000f02dcf012d11c58e5995129293228a2 (diff) | |
parent | 2acc525a972b2b6b071eb5b9596ed1390d6d98e0 (diff) | |
download | cpython-b9b6ce6f2c687092dfc99c912e52cdc32ae44c3d.zip cpython-b9b6ce6f2c687092dfc99c912e52cdc32ae44c3d.tar.gz cpython-b9b6ce6f2c687092dfc99c912e52cdc32ae44c3d.tar.bz2 |
Merge fix for Issue #17011 from 3.3
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_xml_etree.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py index e2ffc19..dec25b5 100644 --- a/Lib/test/test_xml_etree.py +++ b/Lib/test/test_xml_etree.py @@ -1839,6 +1839,20 @@ class ElementFindTest(unittest.TestCase): summarize_list(e.findall(".//{http://effbot.org/ns}tag")), ['{http://effbot.org/ns}tag'] * 3) + def test_findall_different_nsmaps(self): + root = ET.XML(''' + <a xmlns:x="X" xmlns:y="Y"> + <x:b><c/></x:b> + <b/> + <c><x:b/><b/></c><y:b/> + </a>''') + nsmap = {'xx': 'X'} + self.assertEqual(len(root.findall(".//xx:b", namespaces=nsmap)), 2) + self.assertEqual(len(root.findall(".//b", namespaces=nsmap)), 2) + nsmap = {'xx': 'Y'} + self.assertEqual(len(root.findall(".//xx:b", namespaces=nsmap)), 1) + self.assertEqual(len(root.findall(".//b", namespaces=nsmap)), 2) + def test_bad_find(self): e = ET.XML(SAMPLE_XML) with self.assertRaisesRegex(SyntaxError, 'cannot use absolute path'): |