aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib-python/2.7/test/test_xml_etree.py')
-rw-r--r--lib-python/2.7/test/test_xml_etree.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib-python/2.7/test/test_xml_etree.py b/lib-python/2.7/test/test_xml_etree.py
index f6d5d17fc3..f1f1c21cd1 100644
--- a/lib-python/2.7/test/test_xml_etree.py
+++ b/lib-python/2.7/test/test_xml_etree.py
@@ -87,6 +87,19 @@ ENTITY_XML = """\
<document>&entity;</document>
"""
+# backport from https://github.com/python/cpython/pull/22987
+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):
def decorator(test):
@@ -1002,6 +1015,13 @@ class ElementTreeTest(unittest.TestCase):
method='html')
self.assertEqual(serialized, expected)
+ # backported from https://github.com/python/cpython/pull/22987
+ 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'})
+
#
# xinclude tests (samples from appendix C of the xinclude specification)