Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 9 additions & 15 deletions Lib/test/test_minidom.py
Original file line number Diff line number Diff line change
Expand Up @@ -1149,14 +1149,10 @@ def testEncodings(self):

# Verify that character decoding errors raise exceptions instead
# of crashing
if pyexpat.version_info >= (2, 4, 5):
self.assertRaises(ExpatError, parseString,
b'<fran\xe7ais></fran\xe7ais>')
self.assertRaises(ExpatError, parseString,
b'<franais>Comment \xe7a va ? Tr\xe8s bien ?</franais>')
else:
self.assertRaises(UnicodeDecodeError, parseString,
b'<fran\xe7ais>Comment \xe7a va ? Tr\xe8s bien ?</fran\xe7ais>')
with self.assertRaises((UnicodeDecodeError, ExpatError)):
parseString(
b'<fran\xe7ais>Comment \xe7a va ? Tr\xe8s bien ?</fran\xe7ais>'
)

doc.unlink()

Expand Down Expand Up @@ -1617,13 +1613,11 @@ def testEmptyXMLNSValue(self):
self.confirm(doc2.namespaceURI == xml.dom.EMPTY_NAMESPACE)

def testExceptionOnSpacesInXMLNSValue(self):
if pyexpat.version_info >= (2, 4, 5):
context = self.assertRaisesRegex(ExpatError, 'syntax error')
else:
context = self.assertRaisesRegex(ValueError, 'Unsupported syntax')

with context:
parseString('<element xmlns:abc="http:abc.com/de f g/hi/j k"><abc:foo /></element>')
with self.assertRaises((ValueError, ExpatError)):
parseString(
'<element xmlns:abc="http:abc.com/de f g/hi/j k">' +
'<abc:foo /></element>'
)

def testDocRemoveChild(self):
doc = parse(tstfile)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Make two tests forgiving towards host system libexpat with backported security fixes applied.