Unittests: Account for b979fe19e5 (fix one test and add two more)
- Unused XML namespace declarations *are supposed* to be removed - XML namespace declarations that are used as prefix for elements/attributes *must not* be removed
This commit is contained in:
parent
ab1aa0e2f8
commit
32e7e5517f
2 changed files with 20 additions and 4 deletions
20
testscour.py
20
testscour.py
|
|
@ -931,12 +931,26 @@ class WellFormedXMLAmpersandInTextContent(unittest.TestCase):
|
|||
self.assertTrue( wellformed.find('<desc>Peanut Butter & Jelly</desc>') != -1,
|
||||
'Improperly serialized & in text content')
|
||||
|
||||
class WellFormedXMLNamespacePrefix(unittest.TestCase):
|
||||
class WellFormedXMLNamespacePrefixRemoveUnused(unittest.TestCase):
|
||||
def runTest(self):
|
||||
with open('unittests/xml-well-formed.svg') as f:
|
||||
wellformed = scour.scourString(f.read())
|
||||
self.assertTrue( wellformed.find('xmlns:foo=') != -1,
|
||||
'Improperly serialized namespace prefix declarations')
|
||||
self.assertTrue( wellformed.find('xmlns:foo=') == -1,
|
||||
'Improperly serialized namespace prefix declarations: Unused namespace decaration not removed')
|
||||
|
||||
class WellFormedXMLNamespacePrefixKeepUsedElementPrefix(unittest.TestCase):
|
||||
def runTest(self):
|
||||
with open('unittests/xml-well-formed.svg') as f:
|
||||
wellformed = scour.scourString(f.read())
|
||||
self.assertTrue( wellformed.find('xmlns:bar=') != -1,
|
||||
'Improperly serialized namespace prefix declarations: Used element prefix removed')
|
||||
|
||||
class WellFormedXMLNamespacePrefixKeepUsedAttributePrefix(unittest.TestCase):
|
||||
def runTest(self):
|
||||
with open('unittests/xml-well-formed.svg') as f:
|
||||
wellformed = scour.scourString(f.read())
|
||||
self.assertTrue( wellformed.find('xmlns:baz=') != -1,
|
||||
'Improperly serialized namespace prefix declarations: Used attribute prefix removed')
|
||||
|
||||
class NamespaceDeclPrefixesInXMLWhenNotInDefaultNamespace(unittest.TestCase):
|
||||
def runTest(self):
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:foo="http://foo/">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:foo="http://foo/" xmlns:bar="http://bar/" xmlns:baz="http://baz/">
|
||||
<!-- <Jack & Jill> -->
|
||||
<title>2 < 5</title>
|
||||
<desc>Peanut Butter & Jelly</desc>
|
||||
<glyph id="lt" unicode="<"/>
|
||||
<glyph id="amp" unicode="&"/>
|
||||
<glyph id="gt" unicode=">" bar:attr="xyz"/>
|
||||
<baz:glyph id="quot" unicode="""/>
|
||||
<text x="50" y="50">ΉTML & CSS</text>
|
||||
</svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 344 B After Width: | Height: | Size: 481 B |
Loading…
Add table
Add a link
Reference in a new issue