]> git.sommitrealweird.co.uk Git - rss2maildir.git/blobdiff - tests/unittests/UnorderedListTests.py
* fix README to have a more complete config example
[rss2maildir.git] / tests / unittests / UnorderedListTests.py
old mode 100644 (file)
new mode 100755 (executable)
index af09b7c..2224e74
@@ -8,7 +8,7 @@ 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])
 
     def setUp(self):
         self.inputpath = os.path.sep.join(os.path.dirname(os.path.realpath(__file__)).split(os.path.sep)[0:-1])
 
-    def testwellformedlist(self):
+    def testWellFormedList(self):
         try:
             from rss2maildir import HTML2Text
         except:
         try:
             from rss2maildir import HTML2Text
         except:
@@ -25,5 +25,29 @@ class UnorderedListTests(unittest.TestCase):
         output = parser.gettext()
         self.assertEqual(output, expectedoutput)
 
         output = parser.gettext()
         self.assertEqual(output, expectedoutput)
 
+    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)
+
+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()