Skip to content

Commit

Permalink
Merge pull request #30 from mjdunn/master
Browse files Browse the repository at this point in the history
Simple fix
  • Loading branch information
lxneng committed Jun 12, 2016
2 parents 841e0de + 23622c6 commit 5b4fec2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 0 additions & 2 deletions src/xpinyin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ def decode_pinyin(s):
if vowels in t:
t = t.replace(vowels[-1], PinyinToneMark[tone][num])
break
else:
t += "!"
r += t
t = ""
r += t
Expand Down
8 changes: 7 additions & 1 deletion src/xpinyin/tests.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
import unittest


class PinyinTests(unittest.TestCase):
def Pinyin(self, *a, **kw):
from xpinyin import Pinyin
Expand All @@ -24,6 +24,9 @@ def test_get_pinyin_mixed_words(self):
def test_get_pinyin_with_tone_marks(self):
self.assertEqual(self.p.get_pinyin(u'上海', show_tone_marks=True), u'sh\xe0ng-h\u01cei')

def test_get_pinyin_with_tone_marks(self):
self.assertEqual(self.p.get_pinyin(u'秋', show_tone_marks=True), u'qiū')

def test_get_initial(self):
self.assertEqual(self.p.get_initial(u'你'), u'N')

Expand All @@ -33,3 +36,6 @@ def test_get_initials(self):
def test_get_initials_with_splitter(self):
self.assertEqual(self.p.get_initials(u'你好', u' '), u'N H')
self.assertEqual(self.p.get_initials(u'你好', u''), u'NH')

if __name__ == '__main__':
unittest.main()

0 comments on commit 5b4fec2

Please sign in to comment.