summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_xml_etree.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_xml_etree.py')
-rw-r--r--Lib/test/test_xml_etree.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py
index fd4a385..fcb1f7f 100644
--- a/Lib/test/test_xml_etree.py
+++ b/Lib/test/test_xml_etree.py
@@ -108,6 +108,19 @@ EXTERNAL_ENTITY_XML = """\
<document>&entity;</document>
"""
+ATTLIST_XML = """\
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE Foo [
+<!ELEMENT foo (bar*)>
+<!ELEMENT bar (#PCDATA)*>
+<!ATTLIST bar xml:lang CDATA "eng">
+<!ENTITY qux "quux">
+]>
+<foo>
+<bar>&qux;</bar>
+</foo>
+"""
+
def checkwarnings(*filters, quiet=False):
def decorator(test):
def newtest(*args, **kwargs):
@@ -1354,6 +1367,12 @@ class ElementTreeTest(unittest.TestCase):
self.assertEqual(serialize(root, method='html'),
'<cirriculum status="public" company="example"></cirriculum>')
+ def test_attlist_default(self):
+ # Test default attribute values; See BPO 42151.
+ root = ET.fromstring(ATTLIST_XML)
+ self.assertEqual(root[0].attrib,
+ {'{http://www.w3.org/XML/1998/namespace}lang': 'eng'})
+
class XMLPullParserTest(unittest.TestCase):