aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_xml_etree.py
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2019-04-14 10:09:09 +0200
committerGitHub <noreply@github.com>2019-04-14 10:09:09 +0200
commite9927e1820caea01e576141d9a623ea394d43dad (patch)
tree4f758ae025e9b5c1bb6198bb4524571da118489f /Lib/test/test_xml_etree.py
parentffca16e25a70fd44a87b13b379b5ec0c7a11e926 (diff)
downloadcpython-e9927e1820caea01e576141d9a623ea394d43dad.tar.gz
cpython-e9927e1820caea01e576141d9a623ea394d43dad.zip
bpo-30485: support a default prefix mapping in ElementPath by passing None as prefix (#1823)
Diffstat (limited to 'Lib/test/test_xml_etree.py')
-rw-r--r--Lib/test/test_xml_etree.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py
index bdcd4e0d19a..2f7a3b60b22 100644
--- a/Lib/test/test_xml_etree.py
+++ b/Lib/test/test_xml_etree.py
@@ -2463,6 +2463,12 @@ class ElementFindTest(unittest.TestCase):
nsmap = {'xx': 'Y'}
self.assertEqual(len(root.findall(".//xx:b", namespaces=nsmap)), 1)
self.assertEqual(len(root.findall(".//b", namespaces=nsmap)), 2)
+ nsmap = {'xx': 'X', None: 'Y'}
+ self.assertEqual(len(root.findall(".//xx:b", namespaces=nsmap)), 2)
+ self.assertEqual(len(root.findall(".//b", namespaces=nsmap)), 1)
+ nsmap = {'xx': 'X', '': 'Y'}
+ with self.assertRaisesRegex(ValueError, 'namespace prefix'):
+ root.findall(".//xx:b", namespaces=nsmap)
def test_bad_find(self):
e = ET.XML(SAMPLE_XML)