Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
TESTS = [
(u"しつもん", ("si", 1)),
(u"ちがい", ("ti", 1)),
(u"きゃ", ("kya", 2)), (u"きゅ", ("kyu", 2)), (u"きょ", ("kyo", 2)),
(u"しゃ", ("sya", 2)), (u"しゅ", ("syu", 2)), (u"しょ", ("syo", 2)),
(u"ちゃ", ("tya", 2)), (u"ちゅ", ("tyu", 2)), (u"ちょ", ("tyo", 2)),
(u"にゃ", ("nya", 2)), (u"にゅ", ("nyu", 2)), (u"にょ", ("nyo", 2)),
(u"りゃ", ("rya", 2)), (u"りゅ", ("ryu", 2)), (u"りょ", ("ryo", 2)),
(u"ざ", ("za", 1)), (u"じ", ("zi", 1)), (u"ず", ("zu", 1)),
(u"ぜ", ("ze", 1)), (u"ぞ", ("zo", 1)),
(u"だ", ("da", 1)), (u"ぢ", ("zi", 1)), (u"づ", ("zu", 1)),
(u"で", ("de", 1)), (u"ど", ("do", 1)),
(u"た", ("ta", 1)), (u"ち", ("ti", 1)), (u"つ", ("tu", 1)),
(u"て", ("te", 1)), (u"と", ("to", 1))
]
h = pykakasi.scripts.H2("a", method="Kunrei")
for case, result in TESTS:
assert h.convert(case) == result
def test_H2K():
TESTS = [
(u"かんたん", (u"カンタン", 4)),
(u"にゃ", (u"ニャ", 2)),
(u"っき", (u"ッキ", 2)),
(u"っふぁ", (u"ッファ", 3)),
(u"しつもん", (u"シツモン", 4)),
(u"ちがい", (u"チガイ", 3)),
]
h = pykakasi.scripts.H2("K")
for case, result in TESTS:
assert h.convert(case) == result
def test_H2a():
TESTS = [
(u"かんたん", ("ka", 1)),
(u"にゃ", ("nya", 2)),
(u"っき", ("kki", 2)),
(u"っふぁ", ("ffa", 3)),
(u"しつもん", ("shi", 1)),
(u"ちがい", ("chi", 1)),
]
h = pykakasi.scripts.H2("a")
for case, result in TESTS:
assert h.convert(case) == result
def test_H2a_passport():
TESTS = [
(u"しつもん", ("shi", 1)),
(u"ちがい", ("chi", 1)),
(u"おおの", ("o", 2)),
(u"さいとう", ("sa", 1)),
(u"とう", ("to", 2)),
(u"なんば", ("na", 1)),
(u"んば", ("mba", 2))
]
h = pykakasi.scripts.H2("a", method="Passport")
for case, result in TESTS:
assert h.convert(case) == result