diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2015-07-16 07:41:47 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2015-07-16 07:41:47 +0300 |
commit | 8e11d7f20459697c883df1e421df02006f749792 (patch) | |
tree | 9ff24bccbb840535590e2985f45f4205e44244c2 | |
parent | 45b2027439e96c366e188a12bd831802d30bbddc (diff) | |
download | wit-8e11d7f20459697c883df1e421df02006f749792.tar.gz wit-8e11d7f20459697c883df1e421df02006f749792.tar.bz2 |
Fix test.py to work with Python 3
-rw-r--r-- | test.py | 40 |
1 files changed, 21 insertions, 19 deletions
@@ -15,77 +15,78 @@ | |||
15 | # You should have received a copy of the GNU General Public License | 15 | # You should have received a copy of the GNU General Public License |
16 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
18 | from __future__ import print_function | ||
18 | import unittest | 19 | import unittest |
19 | import wiki2html | 20 | import wiki2html |
20 | 21 | ||
21 | class TestMarkupParserBasic (unittest.TestCase): | 22 | class TestMarkupParserBasic (unittest.TestCase): |
22 | 23 | ||
23 | def test_colon(self): | 24 | def test_colon(self): |
24 | self.assert_(self.__test('colon')) | 25 | self.assertTrue(self.__test('colon')) |
25 | pass | 26 | pass |
26 | 27 | ||
27 | def test_headings(self): | 28 | def test_headings(self): |
28 | self.assert_(self.__test('headings')) | 29 | self.assertTrue(self.__test('headings')) |
29 | pass | 30 | pass |
30 | 31 | ||
31 | def test_hz(self): | 32 | def test_hz(self): |
32 | self.assert_(self.__test('hz')) | 33 | self.assertTrue(self.__test('hz')) |
33 | pass | 34 | pass |
34 | 35 | ||
35 | def test_numlist(self): | 36 | def test_numlist(self): |
36 | self.assert_(self.__test('numlist')) | 37 | self.assertTrue(self.__test('numlist')) |
37 | pass | 38 | pass |
38 | 39 | ||
39 | def test_unlist(self): | 40 | def test_unlist(self): |
40 | self.assert_(self.__test('unlist')) | 41 | self.assertTrue(self.__test('unlist')) |
41 | pass | 42 | pass |
42 | 43 | ||
43 | def test_deflist(self): | 44 | def test_deflist(self): |
44 | self.assert_(self.__test('deflist')) | 45 | self.assertTrue(self.__test('deflist')) |
45 | pass | 46 | pass |
46 | 47 | ||
47 | def test_para(self): | 48 | def test_para(self): |
48 | self.assert_(self.__test('para')) | 49 | self.assertTrue(self.__test('para')) |
49 | pass | 50 | pass |
50 | 51 | ||
51 | def test_it(self): | 52 | def test_it(self): |
52 | self.assert_(self.__test('it')) | 53 | self.assertTrue(self.__test('it')) |
53 | pass | 54 | pass |
54 | 55 | ||
55 | def test_bold(self): | 56 | def test_bold(self): |
56 | self.assert_(self.__test('bold')) | 57 | self.assertTrue(self.__test('bold')) |
57 | pass | 58 | pass |
58 | 59 | ||
59 | def test_boldit1(self): | 60 | def test_boldit1(self): |
60 | self.assert_(self.__test('boldit1')) | 61 | self.assertTrue(self.__test('boldit1')) |
61 | pass | 62 | pass |
62 | 63 | ||
63 | def test_itbold1(self): | 64 | def test_itbold1(self): |
64 | self.assert_(self.__test('itbold1')) | 65 | self.assertTrue(self.__test('itbold1')) |
65 | pass | 66 | pass |
66 | 67 | ||
67 | def test_boldit2(self): | 68 | def test_boldit2(self): |
68 | self.assert_(self.__test('boldit2')) | 69 | self.assertTrue(self.__test('boldit2')) |
69 | pass | 70 | pass |
70 | 71 | ||
71 | def test_itbold2(self): | 72 | def test_itbold2(self): |
72 | self.assert_(self.__test('itbold2')) | 73 | self.assertTrue(self.__test('itbold2')) |
73 | pass | 74 | pass |
74 | 75 | ||
75 | def test_boldit3(self): | 76 | def test_boldit3(self): |
76 | self.assert_(self.__test('boldit3')) | 77 | self.assertTrue(self.__test('boldit3')) |
77 | pass | 78 | pass |
78 | 79 | ||
79 | def test_itbold3(self): | 80 | def test_itbold3(self): |
80 | self.assert_(self.__test('itbold3')) | 81 | self.assertTrue(self.__test('itbold3')) |
81 | pass | 82 | pass |
82 | 83 | ||
83 | # def test_door(self): | 84 | # def test_door(self): |
84 | # self.assert_(self.__test('door')) | 85 | # self.assertTrue(self.__test('door')) |
85 | # pass | 86 | # pass |
86 | 87 | ||
87 | # def test_drzwi(self): | 88 | # def test_drzwi(self): |
88 | # self.assert_(self.__test('drzwi')) | 89 | # self.assertTrue(self.__test('drzwi')) |
89 | # pass | 90 | # pass |
90 | 91 | ||
91 | def __test(self, filename): | 92 | def __test(self, filename): |
@@ -93,6 +94,7 @@ class TestMarkupParserBasic (unittest.TestCase): | |||
93 | name_out = 'testdata/' + filename + '.html' | 94 | name_out = 'testdata/' + filename + '.html' |
94 | fh = open(name_out) | 95 | fh = open(name_out) |
95 | buf = ''.join(fh.readlines()).strip() | 96 | buf = ''.join(fh.readlines()).strip() |
97 | fh.close() | ||
96 | hwm = wiki2html.HtmlWiktionaryMarkup(filename=name_in, lang="pl") | 98 | hwm = wiki2html.HtmlWiktionaryMarkup(filename=name_in, lang="pl") |
97 | hwm.parse() | 99 | hwm.parse() |
98 | 100 | ||
@@ -100,8 +102,8 @@ class TestMarkupParserBasic (unittest.TestCase): | |||
100 | return True | 102 | return True |
101 | 103 | ||
102 | # fail | 104 | # fail |
103 | print "\n>>>%s<<<" % buf | 105 | print("\n>>>%s<<<" % buf) |
104 | print ">>>%s<<<" % str(hwm).strip() | 106 | print(">>>%s<<<" % str(hwm).strip()) |
105 | return False | 107 | return False |
106 | 108 | ||
107 | if __name__ == '__main__': | 109 | if __name__ == '__main__': |