Modified scour and added first unit test

This commit is contained in:
JSCHILL1 2009-04-13 11:31:50 -05:00
parent a1f6d9e8dd
commit 8d598b20f2
3 changed files with 35 additions and 3 deletions

View file

@ -19,5 +19,24 @@
import unittest
import scour
import xml.dom.minidom
# performs a test on a given node
# func must return either True or False
def walkTree(elem, func):
if func(elem) == False: return False
for child in elem.childNodes:
if walkTree(child, func) == False: return False
return True
class NoInkscapeElements(unittest.TestCase):
def runTest(self):
doc = scour.scourXmlFile('unittests/inkscape.svg')
self.assertNotEquals( walkTree( doc.documentElement,
lambda e: e.namespaceURI != "http://www.inkscape.org/namespaces/inkscape" ), False,
'Found Inkscape elements' )
if __name__ == '__main__':
unittest.main()
print "done"