File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 108
108
<document>&entity;</document>
109
109
"""
110
110
111
+ ATTLIST_XML = """\
112
+ <?xml version="1.0" encoding="UTF-8"?>
113
+ <!DOCTYPE Foo [
114
+ <!ELEMENT foo (bar*)>
115
+ <!ELEMENT bar (#PCDATA)*>
116
+ <!ATTLIST bar xml:lang CDATA "eng">
117
+ <!ENTITY qux "quux">
118
+ ]>
119
+ <foo>
120
+ <bar>&qux;</bar>
121
+ </foo>
122
+ """
123
+
111
124
def checkwarnings (* filters , quiet = False ):
112
125
def decorator (test ):
113
126
def newtest (* args , ** kwargs ):
@@ -1354,6 +1367,12 @@ def test_tree_write_attribute_order(self):
1354
1367
self .assertEqual (serialize (root , method = 'html' ),
1355
1368
'<cirriculum status="public" company="example"></cirriculum>' )
1356
1369
1370
+ def test_attlist_default (self ):
1371
+ # Test default attribute values; See BPO 42151.
1372
+ root = ET .fromstring (ATTLIST_XML )
1373
+ self .assertEqual (root [0 ].attrib ,
1374
+ {'{http://www.w3.org/XML/1998/namespace}lang' : 'eng' })
1375
+
1357
1376
1358
1377
class XMLPullParserTest (unittest .TestCase ):
1359
1378
You can’t perform that action at this time.
0 commit comments