]> git.sommitrealweird.co.uk Git - rss2maildir.git/blobdiff - tests/unittests/UnorderedListTests.py
simple typo fix
[rss2maildir.git] / tests / unittests / UnorderedListTests.py
index 4d2c393add11c614a9b026ea710e9f6c083ed147..026274a350eb249bb74733cccf960ac912a77620 100755 (executable)
@@ -4,44 +4,20 @@ import unittest
 import sys
 import os
 
 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
 
 
-    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)
+class UnorderedListTests(ParsingTests.ParsingTest):
+    def testWellFormedList(self):
+        return self.runParsingTest("unorderedlist-wellformed")
 
 
-    def testbadlyformed(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)
+    def testBadlyFormedList(self):
+        return self.runParsingTest("unorderedlist-badlyformed")
 
 
-        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)
+def suite():
+    suite = unittest.TestSuite()
+    suite.addTest(UnorderedListTests("testWellFormedList"))
+    suite.addTest(UnorderedListTests("testBadlyFormedList"))
+    return suite
 
 if __name__ == "__main__":
     unittest.main()
 
 if __name__ == "__main__":
     unittest.main()