OSDN Git Service

create html2wiki
[otptools/otptools.git] / html2wiki / test_html2sfjpwiki.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 """Test suite for spyder.py."""
4
5 import unittest
6 import re
7 import html2sfjpwiki
8
9 class TestSequenceFunctions(unittest.TestCase):
10     def setUp(self):
11         self.test_file = "fetch_test/09/09/10/1214252/1/body.html"
12         fh = open(self.test_file, "r")
13         html = fh.read()
14         fh.close()
15
16         rex = re.compile(r"<\s*script[^>]*?>.*?</script>", re.S)
17         rex2 = re.compile(r"<\s*noscript[^>]*?>.*?</noscript>", re.S)
18         tmp = rex.sub("", html)
19         self.test_data = rex2.sub("", tmp)
20
21     def test_convert(self):
22         """test for convert"""
23         c = html2sfjpwiki.Html2SfjpWiki()
24         r = c.parse(self.test_data, "article-body")
25         print r
26
27
28 # do unittest
29 suite = unittest.TestLoader().loadTestsFromTestCase(TestSequenceFunctions)
30 unittest.TextTestRunner(verbosity=2).run(suite)
31