diff --git a/testscour.py b/testscour.py
index 98c357b..7b29bdf 100755
--- a/testscour.py
+++ b/testscour.py
@@ -931,12 +931,26 @@ class WellFormedXMLAmpersandInTextContent(unittest.TestCase):
self.assertTrue( wellformed.find('Peanut Butter & Jelly') != -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):
diff --git a/unittests/xml-well-formed.svg b/unittests/xml-well-formed.svg
index 705a288..5c8d706 100644
--- a/unittests/xml-well-formed.svg
+++ b/unittests/xml-well-formed.svg
@@ -1,9 +1,11 @@
-