diff options
Diffstat (limited to 'share/extensions/tests/test_inkex_tester.py')
-rw-r--r-- | share/extensions/tests/test_inkex_tester.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/share/extensions/tests/test_inkex_tester.py b/share/extensions/tests/test_inkex_tester.py new file mode 100644 index 0000000..a5ce31a --- /dev/null +++ b/share/extensions/tests/test_inkex_tester.py @@ -0,0 +1,28 @@ +# coding=utf-8 +""" +Test Inkex tester functionality +""" +from inkex.tester import TestCase +from inkex.tester.xmldiff import xmldiff + +class TesterTest(TestCase): + """Ironic""" + maxDiff = 20000 + + def get_file(self, filename): + """Get the contents of a file""" + with open(self.data_file('svg', filename), 'rb') as fhl: + return fhl.read() + + def test_xmldiff(self): + """XML Diff""" + xml_a = self.get_file('shapes.svg') + xml_b = self.get_file('diff.svg') + + xml, delta = xmldiff(xml_a, xml_b) + self.assertFalse(delta) + self.assertEqual(str(delta), '7 xml differences') + #self.assertEqual(str(xml), '') + xml, delta = xmldiff(xml_a, xml_a) + self.assertTrue(delta) + self.assertEqual(str(delta), 'No differences detected') |