]> git.sommitrealweird.co.uk Git - rss2maildir.git/blobdiff - tests/unittests/DefinitionListTests.py
Fix issue with images having the same alt value but different urls
[rss2maildir.git] / tests / unittests / DefinitionListTests.py
index 905897307c31b3a198f5b164ea40befcf1836f51..a1abae02874dde93b70746a9d244f9425cece831 100755 (executable)
@@ -1,33 +1,21 @@
 #!/usr/bin/python
 
 import unittest
-import sys
 import os
 
-class DefinitionListTests(unittest.TestCase):
-    def setUp(self):
-        self.inputpath = os.path.sep.join(os.path.dirname(os.path.realpath(__file__)).split(os.path.sep)[0:-1])
+import ParsingTests
 
+class DefinitionListTests(ParsingTests.ParsingTest):
     def testWellFormedDefinitionList(self):
-        try:
-            from rss2maildir import HTML2Text
-        except:
-            sys.path.append(os.path.sep.join(self.inputpath.split(os.path.sep)[0:-1]))
-            try:
-                from rss2maildir import HTML2Text
-            except:
-                self.assert_(False)
-        input_path = os.path.sep.join(os.path.dirname(os.path.realpath(__file__)).split(os.path.sep)[0:-1])
-        input = open(os.path.join(input_path, "html", "definitionlist-wellformed.html")).read()
-        expectedoutput = open(os.path.join(input_path, "expected", "definitionlist-wellformed.txt")).read()
-        parser = HTML2Text()
-        parser.feed(input)
-        output = parser.gettext()
-        self.assertEqual(output, expectedoutput)
+        return self.runParsingTest("definitionlist-wellformed")
+
+    def testBadlyFormedDefinitionList(self):
+        return self.runParsingTest("definitionlist-badlyformed")
 
 def suite():
     suite = unittest.TestSuite()
     suite.addTest(DefinitionListTests("testWellFormedDefinitionList"))
+    suite.addTest(DefinitionListTests("testBadlyFormedDefinitionList"))
     return suite
 
 if __name__ == "__main__":