def test_drop_apostrophe(self): self.assertEqual(trans.pinyin_to_zhuyin("xi1'an1"), "ㄒㄧ ㄢ") self.assertEqual(trans.pinyin_to_ipa("xi1'an1"), "ɕi˥ an˥") self.assertEqual(trans.to_pinyin("xi1'an1"), "xī'ān") self.assertEqual(trans.pinyin_to_zhuyin("xī'ān"), "ㄒㄧ ㄢ") self.assertEqual(trans.pinyin_to_ipa("xī'ān"), "ɕi˥ an˥") self.assertEqual(trans.to_pinyin("xī'ān", accented=False), "xi1'an1")
def test_drop_apostrophe(self): self.assertEqual(trans.pinyin_to_zhuyin("xi1'an1"), 'ㄒㄧ ㄢ') self.assertEqual(trans.pinyin_to_ipa("xi1'an1"), 'ɕi˥ an˥') self.assertEqual(trans.to_pinyin("xi1'an1"), "xī'ān") self.assertEqual(trans.pinyin_to_zhuyin("xī'ān"), 'ㄒㄧ ㄢ') self.assertEqual(trans.pinyin_to_ipa("xī'ān"), 'ɕi˥ an˥') self.assertEqual(trans.to_pinyin("xī'ān", accented=False), "xi1'an1")
def test_pinyin_middle_dot(self): self.assertEqual(trans.to_pinyin("\u00B7zi", accented=False), "zi5")
def test_accented_to_numbered(self): numbered_pinyin = trans.to_pinyin(self.accented_pinyin, accented=False) self.assertEqual(numbered_pinyin, self.numbered_pinyin)
def test_numbered_to_accented(self): accented_pinyin = trans.to_pinyin(self.numbered_pinyin) self.assertEqual(accented_pinyin, self.accented_pinyin)
def test_handle_middle_dot(self): self.assertEqual(trans.to_pinyin("ān\u00B7jing", accented=False), "an1jing5")
def test_pinyin_r_suffix(self): self.assertEqual(trans.to_pinyin("hua1r5"), "hu\u0101r") self.assertEqual(trans.to_pinyin("hu\u0101r", accented=False), "hua1r5")
def test_pinyin_r_suffix(self): self.assertEqual(trans.to_pinyin('hua1r5'), 'hu\u0101r') self.assertEqual(trans.to_pinyin('hu\u0101r', accented=False), 'hua1r5')
def test_pinyin_middle_dot(self): self.assertEqual(trans.to_pinyin('\u00B7zi', accented=False), 'zi5')
def test_handle_middle_dot(self): self.assertEqual(trans.to_pinyin('ān\u00B7jing', accented=False), 'an1jing5')