Add remainder of Adobe namespaces and unit tests
This commit is contained in:
parent
d4dc4b7c42
commit
7cfb655cff
3 changed files with 54 additions and 20 deletions
9
scour.py
9
scour.py
|
|
@ -79,12 +79,17 @@ NS = { 'SVG': 'http://www.w3.org/2000/svg',
|
||||||
'ADOBE_SVG_VIEWER': 'http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/',
|
'ADOBE_SVG_VIEWER': 'http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/',
|
||||||
'ADOBE_VARIABLES': 'http://ns.adobe.com/Variables/1.0/',
|
'ADOBE_VARIABLES': 'http://ns.adobe.com/Variables/1.0/',
|
||||||
'ADOBE_SFW': 'http://ns.adobe.com/SaveForWeb/1.0/',
|
'ADOBE_SFW': 'http://ns.adobe.com/SaveForWeb/1.0/',
|
||||||
'ADOBE_EXTENSIBILITY': 'http://ns.adobe.com/Extensibility/1.0/'
|
'ADOBE_EXTENSIBILITY': 'http://ns.adobe.com/Extensibility/1.0/',
|
||||||
|
'ADOBE_FLOWS': 'http://ns.adobe.com/Flows/1.0/',
|
||||||
|
'ADOBE_IMAGE_REPLACEMENT': 'http://ns.adobe.com/ImageReplacement/1.0/',
|
||||||
|
'ADOBE_CUSTOM': 'http://ns.adobe.com/GenericCustomNamespace/1.0/',
|
||||||
|
'ADOBE_XPATH': 'http://ns.adobe.com/XPath/1.0/'
|
||||||
}
|
}
|
||||||
|
|
||||||
unwanted_ns = [ NS['SODIPODI'], NS['INKSCAPE'], NS['ADOBE_ILLUSTRATOR'],
|
unwanted_ns = [ NS['SODIPODI'], NS['INKSCAPE'], NS['ADOBE_ILLUSTRATOR'],
|
||||||
NS['ADOBE_GRAPHS'], NS['ADOBE_SVG_VIEWER'], NS['ADOBE_VARIABLES'],
|
NS['ADOBE_GRAPHS'], NS['ADOBE_SVG_VIEWER'], NS['ADOBE_VARIABLES'],
|
||||||
NS['ADOBE_SFW'], NS['ADOBE_EXTENSIBILITY'] ]
|
NS['ADOBE_SFW'], NS['ADOBE_EXTENSIBILITY'], NS['ADOBE_FLOWS'],
|
||||||
|
NS['ADOBE_IMAGE_REPLACEMENT'], NS['ADOBE_CUSTOM'], NS['ADOBE_XPATH'] ]
|
||||||
|
|
||||||
svgAttributes = [
|
svgAttributes = [
|
||||||
'clip-rule',
|
'clip-rule',
|
||||||
|
|
|
||||||
35
testscour.py
35
testscour.py
|
|
@ -44,26 +44,57 @@ class NoSodipodiElements(unittest.TestCase):
|
||||||
lambda e: e.namespaceURI != 'http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd'), False,
|
lambda e: e.namespaceURI != 'http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd'), False,
|
||||||
'Found Sodipodi elements' )
|
'Found Sodipodi elements' )
|
||||||
|
|
||||||
class NoAdobeElements(unittest.TestCase):
|
class NoAdobeIllustratorElements(unittest.TestCase):
|
||||||
def runTest(self):
|
def runTest(self):
|
||||||
self.assertNotEquals(walkTree(scour.scourXmlFile('unittests/adobe.svg').documentElement,
|
self.assertNotEquals(walkTree(scour.scourXmlFile('unittests/adobe.svg').documentElement,
|
||||||
lambda e: e.namespaceURI != 'http://ns.adobe.com/AdobeIllustrator/10.0/'), False,
|
lambda e: e.namespaceURI != 'http://ns.adobe.com/AdobeIllustrator/10.0/'), False,
|
||||||
'Found Adobe Illustrator elements' )
|
'Found Adobe Illustrator elements' )
|
||||||
|
class NoAdobeGraphsElements(unittest.TestCase):
|
||||||
|
def runTest(self):
|
||||||
self.assertNotEquals(walkTree(scour.scourXmlFile('unittests/adobe.svg').documentElement,
|
self.assertNotEquals(walkTree(scour.scourXmlFile('unittests/adobe.svg').documentElement,
|
||||||
lambda e: e.namespaceURI != 'http://ns.adobe.com/Graphs/1.0/'), False,
|
lambda e: e.namespaceURI != 'http://ns.adobe.com/Graphs/1.0/'), False,
|
||||||
'Found Adobe Graphs elements' )
|
'Found Adobe Graphs elements' )
|
||||||
|
class NoAdobeSVGViewerElements(unittest.TestCase):
|
||||||
|
def runTest(self):
|
||||||
self.assertNotEquals(walkTree(scour.scourXmlFile('unittests/adobe.svg').documentElement,
|
self.assertNotEquals(walkTree(scour.scourXmlFile('unittests/adobe.svg').documentElement,
|
||||||
lambda e: e.namespaceURI != 'http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/'), False,
|
lambda e: e.namespaceURI != 'http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/'), False,
|
||||||
'Found Adobe SVG Viewer elements' )
|
'Found Adobe SVG Viewer elements' )
|
||||||
|
class NoAdobeVariablesElements(unittest.TestCase):
|
||||||
|
def runTest(self):
|
||||||
self.assertNotEquals(walkTree(scour.scourXmlFile('unittests/adobe.svg').documentElement,
|
self.assertNotEquals(walkTree(scour.scourXmlFile('unittests/adobe.svg').documentElement,
|
||||||
lambda e: e.namespaceURI != 'http://ns.adobe.com/Variables/1.0/'), False,
|
lambda e: e.namespaceURI != 'http://ns.adobe.com/Variables/1.0/'), False,
|
||||||
'Found Adobe Variables elements' )
|
'Found Adobe Variables elements' )
|
||||||
|
class NoAdobeSaveForWebElements(unittest.TestCase):
|
||||||
|
def runTest(self):
|
||||||
self.assertNotEquals(walkTree(scour.scourXmlFile('unittests/adobe.svg').documentElement,
|
self.assertNotEquals(walkTree(scour.scourXmlFile('unittests/adobe.svg').documentElement,
|
||||||
lambda e: e.namespaceURI != 'http://ns.adobe.com/SaveForWeb/1.0/'), False,
|
lambda e: e.namespaceURI != 'http://ns.adobe.com/SaveForWeb/1.0/'), False,
|
||||||
'Found Adobe Save For Web elements' )
|
'Found Adobe Save For Web elements' )
|
||||||
|
class NoAdobeExtensibilityElements(unittest.TestCase):
|
||||||
|
def runTest(self):
|
||||||
self.assertNotEquals(walkTree(scour.scourXmlFile('unittests/adobe.svg').documentElement,
|
self.assertNotEquals(walkTree(scour.scourXmlFile('unittests/adobe.svg').documentElement,
|
||||||
lambda e: e.namespaceURI != 'http://ns.adobe.com/Extensibility/1.0/'), False,
|
lambda e: e.namespaceURI != 'http://ns.adobe.com/Extensibility/1.0/'), False,
|
||||||
'Found Adobe Extensibility elements' )
|
'Found Adobe Extensibility elements' )
|
||||||
|
class NoAdobeFlowsElements(unittest.TestCase):
|
||||||
|
def runTest(self):
|
||||||
|
self.assertNotEquals(walkTree(scour.scourXmlFile('unittests/adobe.svg').documentElement,
|
||||||
|
lambda e: e.namespaceURI != 'http://ns.adobe.com/Flows/1.0/'), False,
|
||||||
|
'Found Adobe Flows elements' )
|
||||||
|
class NoAdobeImageReplacementElements(unittest.TestCase):
|
||||||
|
def runTest(self):
|
||||||
|
self.assertNotEquals(walkTree(scour.scourXmlFile('unittests/adobe.svg').documentElement,
|
||||||
|
lambda e: e.namespaceURI != 'http://ns.adobe.com/ImageReplacement/1.0/'), False,
|
||||||
|
'Found Adobe Image Replacement elements' )
|
||||||
|
class NoAdobeCustomElements(unittest.TestCase):
|
||||||
|
def runTest(self):
|
||||||
|
self.assertNotEquals(walkTree(scour.scourXmlFile('unittests/adobe.svg').documentElement,
|
||||||
|
lambda e: e.namespaceURI != 'http://ns.adobe.com/GenericCustomNamespace/1.0/'), False,
|
||||||
|
'Found Adobe Custom elements' )
|
||||||
|
class NoAdobeXPathElements(unittest.TestCase):
|
||||||
|
def runTest(self):
|
||||||
|
self.assertNotEquals(walkTree(scour.scourXmlFile('unittests/adobe.svg').documentElement,
|
||||||
|
lambda e: e.namespaceURI != 'http://ns.adobe.com/XPath/1.0/'), False,
|
||||||
|
'Found Adobe XPath elements' )
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,21 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<svg xmlns="http://www.w3.org/2000/svg"
|
||||||
<!-- Generator: Adobe Illustrator 10.0.3, SVG Export Plug-In . SVG Version: 3.0.0 Build 77) -->
|
xmlns:x="http://ns.adobe.com/Extensibility/1.0/"
|
||||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [
|
xmlns:i="http://ns.adobe.com/AdobeIllustrator/10.0/"
|
||||||
<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
|
xmlns:graph="http://ns.adobe.com/Graphs/1.0/"
|
||||||
<!ENTITY ns_extend "http://ns.adobe.com/Extensibility/1.0/">
|
xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
|
||||||
<!ENTITY ns_ai "http://ns.adobe.com/AdobeIllustrator/10.0/">
|
xmlns:f="http://ns.adobe.com/Flows/1.0/"
|
||||||
<!ENTITY ns_graphs "http://ns.adobe.com/Graphs/1.0/">
|
xmlns:ir="http://ns.adobe.com/ImageReplacement/1.0/"
|
||||||
<!ENTITY ns_vars "http://ns.adobe.com/Variables/1.0/">
|
xmlns:custom="http://ns.adobe.com/GenericCustomNamespace/1.0/"
|
||||||
<!ENTITY ns_imrep "http://ns.adobe.com/ImageReplacement/1.0/">
|
xmlns:xpath="http://ns.adobe.com/XPath/1.0/"
|
||||||
<!ENTITY ns_sfw "http://ns.adobe.com/SaveForWeb/1.0/">
|
i:viewOrigin="190.2959 599.1841" i:rulerOrigin="0 0" i:pageBounds="0 792 612 0">
|
||||||
<!ENTITY ns_custom "http://ns.adobe.com/GenericCustomNamespace/1.0/">
|
|
||||||
<!ENTITY ns_adobe_xpath "http://ns.adobe.com/XPath/1.0/">
|
|
||||||
<!ENTITY ns_svg "http://www.w3.org/2000/svg">
|
|
||||||
<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
|
|
||||||
]>
|
|
||||||
<svg xmlns:x="http://ns.adobe.com/Extensibility/1.0/" xmlns:i="http://ns.adobe.com/AdobeIllustrator/10.0/" xmlns:graph="http://ns.adobe.com/Graphs/1.0/" i:viewOrigin="190.2959 599.1841" i:rulerOrigin="0 0" i:pageBounds="0 792 612 0" xmlns="http://www.w3.org/2000/svg" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/">
|
|
||||||
<x:foo>bar</x:foo>
|
<x:foo>bar</x:foo>
|
||||||
<i:foo>bar</i:foo>
|
<i:foo>bar</i:foo>
|
||||||
<graph:foo>bar</graph:foo>
|
<graph:foo>bar</graph:foo>
|
||||||
<a:foo>bar</a:foo>
|
<a:foo>bar</a:foo>
|
||||||
|
<f:foo>bar</f:foo>
|
||||||
|
<ir:foo>bar</ir:foo>
|
||||||
|
<custom:foo>bar</custom:foo>
|
||||||
|
<xpath:foo>bar</xpath:foo>
|
||||||
<variableSets xmlns="http://ns.adobe.com/Variables/1.0/">
|
<variableSets xmlns="http://ns.adobe.com/Variables/1.0/">
|
||||||
<variableSet varSetName="binding1" locked="none">
|
<variableSet varSetName="binding1" locked="none">
|
||||||
<variables/>
|
<variables/>
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.2 KiB |
Loading…
Add table
Add a link
Reference in a new issue