* Small improvements to the HTML2Text code
[rss2maildir.git] / tests / unittests / UnorderedListTests.py
index 2224e74427b952556a2235f1ca3133402f0d8990..a49546165a18e1a32f6fb4e56e376f353423d6b0 100755 (executable)
@@ -4,44 +4,14 @@ import unittest
 import sys
 import os
 
-class UnorderedListTests(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 UnorderedListTests(ParsingTests.ParsingTest):
     def testWellFormedList(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", "unorderedlist-wellformed.html")).read()
-        expectedoutput = open(os.path.join(input_path, "expected", "unorderedlist-wellformed.txt")).read()
-        parser = HTML2Text()
-        parser.feed(input)
-        output = parser.gettext()
-        self.assertEqual(output, expectedoutput)
+        return self.runParsingTest("unordered-wellformed")
 
     def testBadlyFormedList(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", "unorderedlist-badlyformed.html")).read()
-        expectedoutput = open(os.path.join(input_path, "expected", "unorderedlist-badlyformed.txt")).read()
-        parser = HTML2Text()
-        parser.feed(input)
-        output = parser.gettext()
-        self.assertEqual(output, expectedoutput)
+        return self.runParsingTest("unordered-badlyformed")
 
 def suite():
     suite = unittest.TestSuite()