Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_kakasi_long_symbol_H():
TESTS = [
(u'γγ£γγΌ', u'yattaa'),
(u'γ§γ£γ§γΌ', u'deddee'),
(u'γ¦γγγΌγ΅γγΌ', u'tensaafuroo'),
(u'γγ£γγΌγ', u'gaggaan'),
(u'γ©γΌγ', u'doon')
]
kakasi = pykakasi.kakasi()
kakasi.setMode('H', 'a')
converter = kakasi.getConverter()
for case, result in TESTS:
print(converter.do(case))
assert converter.do(case) == result
def test_issues60():
TESTS = [
(u"εΈη«", u"γγγ€")
]
kakasi = pykakasi.kakasi()
kakasi.setMode("H", None)
kakasi.setMode("K", None)
kakasi.setMode("J", "H")
kakasi.setMode("s", False)
kakasi.setMode("C", True)
kakasi.setMode("E", None)
kakasi.setMode("a", None)
converter = kakasi.getConverter()
for case, result in TESTS:
assert converter.do(case) == result
def test_kakasi_E2a_upper():
TESTS = [
(u"ο½ο½ο½ο½ο½
ο½ο½ο½ο½ο½ο½ο½ο½ο½ο½ο½ο½ο½ο½ο½ο½ο½ο½ο½ο½ο½", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"),
]
kakasi = pykakasi.kakasi()
kakasi.setMode("E", "a")
kakasi.setMode("U", True)
converter = kakasi.getConverter()
for case, result in TESTS:
assert converter.do(case) == result
TESTS = [
("ζ§ζ", "Kousei"),
("ε₯½γ", "Suki"),
("倧γγ", "Ookii"),
("γγγγ", "kantan"),
("γ«γ", "nya"),
("γ£γ", "kki"),
("γ£γ΅γ", "ffa"),
("ζΌ’εγ¨γ²γγγͺδΊ€γγζ", "Kanzi tohiragana Maziri Bun"),
("Alphabet 123 and ζΌ’ε", "Alphabet 123 and Kanzi"),
("ζ₯η΅ζ°θ", "Nikkeisinbun"),
("ζ₯ζ¬ε½ζ°γ―γ","Nihonkokumin ha,")
]
kakasi = pykakasi.kakasi()
kakasi.setMode("H","a")
kakasi.setMode("K","a")
kakasi.setMode("J","a")
kakasi.setMode("r","Kunrei")
kakasi.setMode("C",True)
kakasi.setMode("s",True)
kakasi.setMode("E","a")
converter = kakasi.getConverter()
for case, result in TESTS:
self.assertEqual(converter.do(case), result)
TESTS = [
(u"", ""),
(u"ζ§ζ", "Kousei"),
(u"ε₯½γ", "Suki"),
(u"倧γγ", "Ookii"),
(u"γγγγ", "kantan"),
(u"γ«γ", "nya"),
(u"γ£γ", "kki"),
(u"γ£γ΅γ", "ffa"),
(u"ζΌ’εγ¨γ²γγγͺδΊ€γγζ", "Kanzi tohiragana Maziri Bun"),
(u"Alphabet 123 and ζΌ’ε", "Alphabet 123 and Kanzi"),
(u"ζ₯η΅ζ°θ", "Nikkeisinbun"),
(u"ζ₯ζ¬ε½ζ°γ―γ", "Nihonkokumin ha,")
]
kakasi = pykakasi.kakasi()
kakasi.setMode("H", "a")
kakasi.setMode("K", "a")
kakasi.setMode("J", "a")
kakasi.setMode("r", "Kunrei")
kakasi.setMode("E", "a")
kakasi.setMode("s", True)
kakasi.setMode("a", None)
kakasi.setMode("C", True)
converter = kakasi.getConverter()
for case, result in TESTS:
assert converter.do(case) == result
def test_issues59():
TESTS = [
(u"γγγΌγ", u"γγγΌγ"),
(u"γ·γΈγΉγΊ", u"γ·γΈγΉγΊ")
]
kakasi = pykakasi.kakasi()
kakasi.setMode("H", None)
kakasi.setMode("K", "H")
kakasi.setMode("J", None)
kakasi.setMode("s", False)
kakasi.setMode("C", True)
kakasi.setMode("E", None)
kakasi.setMode("a", None)
converter = kakasi.getConverter()
for case, result in TESTS:
assert converter.do(case) == result
def test_kakasi_passport_specialcase():
TESTS = [
(u"γγ£γ‘γ
γ", "etchu"),
(u"γ―γ£γ‘γγ", "hatcho"),
(u"γ¨γγγ₯γ¦", "etchu"),
(u"γγγγ§γ¦", "hatcho")
]
kakasi = pykakasi.kakasi()
kakasi.setMode("H", "a")
kakasi.setMode("K", "a")
kakasi.setMode("J", "a")
kakasi.setMode("r", "Passport")
kakasi.setMode("E", "a")
kakasi.setMode("a", None)
converter = kakasi.getConverter()
for case, result in TESTS:
assert converter.do(case) == result
def test_kakasi_unknown_mode():
with pytest.raises(InvalidModeValueException):
kakasi = pykakasi.kakasi()
kakasi.setMode("H", "a")
kakasi.setMode("K", "a")
kakasi.setMode("J", "X")
if i == 2:
kakasi = pykakasi.kakasi()
kakasi.setMode("H", "a")
kakasi.setMode("K", "a")
kakasi.setMode("J", "a")
kakasi.setMode("s", True)
kakasi.setMode("E", "a")
kakasi.setMode("a", None)
kakasi.setMode("C", False)
converter = kakasi.getConverter()
title=converter.do(title)
title=title[0].upper()+title[1:]
editor=converter.do(editor)
editor=editor[0].upper()+editor[1:]
if i == 14 or i == 13 or i==12:
kakasi = pykakasi.kakasi()
kakasi.setMode("H", "a")
kakasi.setMode("K", "a")
kakasi.setMode("J", "a")
kakasi.setMode("s", True)
kakasi.setMode("E", "a")
kakasi.setMode("a", None)
kakasi.setMode("C", False)
message=("Language: "+str(NacpLanguageType(i)).replace('NacpLanguageType.', ''));feed=self.html_feed(feed,6,message)
feed+='<ul style="margin-bottom: 2px;margin-top: 3px">'
message=["Name:",title];feed=self.html_feed(feed,3,message)
message=["Publisher:",editor];feed=self.html_feed(feed,3,message)
feed+='</ul>'
return feed
if i == 2:
kakasi = pykakasi.kakasi()
kakasi.setMode("H", "a")
kakasi.setMode("K", "a")
kakasi.setMode("J", "a")
kakasi.setMode("s", True)
kakasi.setMode("E", "a")
kakasi.setMode("a", None)
kakasi.setMode("C", False)
converter = kakasi.getConverter()
title=converter.do(title)
title=title[0].upper()+title[1:]
editor=converter.do(editor)
editor=editor[0].upper()+editor[1:]
if i == 14 or i == 13 or i==12:
kakasi = pykakasi.kakasi()
kakasi.setMode("H", "a")
kakasi.setMode("K", "a")
kakasi.setMode("J", "a")
kakasi.setMode("s", True)
kakasi.setMode("E", "a")
kakasi.setMode("a", None)
kakasi.setMode("C", False)
if gui==True:
message=('...............................');print(message);feed+=message+'...............................'*2+'\n'
message=('Language: '+ str(NacpLanguageType(i)).replace('NacpLanguageType.', ''));print(message);feed+=message+'\n'
message=('...............................');print(message);feed+=message+'...............................'*2+'\n'
message=('- Name: '+ title);print(message);feed+=message+'\n'
message=('- Publisher: '+ editor);print(message);feed+=message+'\n'
else:
message=('...............................');print(message);feed+=message+'\n'
message=('Language: '+ str(NacpLanguageType(i)).replace('NacpLanguageType.', ''));print(message);feed+=message+'\n'