X-Git-Url: https://git.sommitrealweird.co.uk/rss2maildir.git/blobdiff_plain/286e096cd216854c5a9bc8cdc580e5d3ec447f19..f47e451a2ae7cde0b422266b10b131d00d398e87:/tests/unittests/ParsingTests.py diff --git a/tests/unittests/ParsingTests.py b/tests/unittests/ParsingTests.py new file mode 100755 index 0000000..20fc521 --- /dev/null +++ b/tests/unittests/ParsingTests.py @@ -0,0 +1,26 @@ +#!/usr/bin/python + +import unittest +import sys +import os + +class ParsingTest(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 runParsingTest(self, filename): + 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", filename + ".html")).read() + expectedoutput = open(os.path.join(input_path, "expected", filename + ".txt")).read() + parser = HTML2Text() + parser.feed(input) + output = parser.gettext() + self.assertEqual(output, expectedoutput)