blob: 22e5393531fb15da6be47ff1b4221931c44f080e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2008 Sergey Poznyakoff
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import unittest
import wiki2html
class TestMarkupParserBasic (unittest.TestCase):
def test_colon(self):
self.assert_(self.__test('colon'))
pass
def test_headings(self):
self.assert_(self.__test('headings'))
pass
def test_hz(self):
self.assert_(self.__test('hz'))
pass
def test_numlist(self):
self.assert_(self.__test('numlist'))
pass
def test_unlist(self):
self.assert_(self.__test('unlist'))
pass
def test_door(self):
self.assert_(self.__test('door'))
pass
def test_drzwi(self):
self.assert_(self.__test('drzwi'))
pass
def __test(self, filename):
name_in = 'testdata/' + filename + '.wiki'
name_out = 'testdata/' + filename + '.html'
fh = open(name_out)
buf = ''.join(fh.readlines()).strip()
hwm = wiki2html.HtmlWiktionaryMarkup(filename=name_in, lang="pl")
hwm.parse()
if str(hwm).strip() == buf:
return True
# fail
print "\n>>>%s<<<" % buf
print ">>>%s<<<" % str(hwm).strip()
return False
if __name__ == '__main__':
unittest.main()
|