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:
Eduard Braun 2015-12-07 00:27:25 +01:00
parent ab1aa0e2f8
commit 32e7e5517f
2 changed files with 20 additions and 4 deletions

View file

@ -931,12 +931,26 @@ class WellFormedXMLAmpersandInTextContent(unittest.TestCase):
self.assertTrue( wellformed.find('<desc>Peanut Butter &amp; Jelly</desc>') != -1,
'Improperly serialized &amp; 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):