-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_romanizer.py
41 lines (36 loc) · 2.24 KB
/
test_romanizer.py
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
# -*- coding: utf-8 -*-
import unittest
from romanizer import to_hepburn, to_kunrei
class HepbernTestCase(unittest.TestCase):
def test_hepburn(self):
self.assertEqual(u'', to_hepburn(u''))
self.assertEqual(u'aiueo', to_hepburn(u'あいうえお'))
self.assertEqual(u'gumma', to_hepburn(u'ぐんま'))
self.assertEqual(u'chimpui', to_hepburn(u'チンプイ'))
self.assertEqual(u'bampuobuchikin', to_hepburn(u'バンプオブチキン'))
self.assertEqual(u'kanda', to_hepburn(u'かんだ'))
self.assertEqual(u'bozuga jozuni byobuni bozuno eokaita', to_hepburn(u'ボウズガ ジョウズニ ビョウブニ ボウズノ エヲカイタ'))
self.assertEqual(u'beppu', to_hepburn(u'べっぷ'))
self.assertEqual(u'kotchi', to_hepburn(u'コッチ'))
self.assertEqual(u'nnnnnn', to_hepburn(u'んんんンンン'))
self.assertEqual(u'oi toru onishi', to_hepburn(u'おーい とおる おおにし'))
self.assertEqual(u"shinichi", to_hepburn(u'シンイチ'))
self.assertEqual(u'shonin', to_hepburn(u'しょーにん'))
self.assertEqual(u'joho', to_hepburn(u'じょうほう'))
def test_kunrei(self):
self.assertEqual(u'', to_kunrei(u''))
self.assertEqual(u'aiueo', to_kunrei(u'あいうえお'))
self.assertEqual(u'gunma', to_kunrei(u'ぐんま'))
self.assertEqual(u'tinpui', to_kunrei(u'チンプイ'))
self.assertEqual(u'banpuobutikin', to_kunrei(u'バンプオブチキン'))
self.assertEqual(u'kanda', to_kunrei(u'かんだ'))
self.assertEqual(u'bôzuga zyôzuni byôbuni bôzuno ewokaita', to_kunrei(u'ボウズガ ジョウズニ ビョウブニ ボウズノ エヲカイタ'))
self.assertEqual(u'beppu', to_kunrei(u'べっぷ'))
self.assertEqual(u'kotti', to_kunrei(u'コッチ'))
self.assertEqual(u'nnnnnn', to_kunrei(u'んんんンンン'))
self.assertEqual(u'ôi tôru ônisi', to_kunrei(u'おーい とおる おおにし'))
self.assertEqual(u"sin'iti", to_kunrei(u'シンイチ'))
self.assertEqual(u'syônin', to_kunrei(u'しょーにん'))
self.assertEqual(u'zyôhô', to_kunrei(u'じょうほう'))
if __name__ == '__main__':
unittest.main()