def test_punctuation(self): self.assertEqual(separate_trans('Méiyǒu, méiyǒu.'), ['Méi yǒu', ',', 'méi yǒu', '.']) self.assertEqual( separate_trans('Méi yǒu, méi yǒu.', grouped=False), ['Méi', 'yǒu', ',', 'méi', 'yǒu', '.'], ) self.assertEqual( separate_trans('(méi) yǒu', grouped=False), ['(', 'méi', ')', 'yǒu'], )
def test_apostrophe(self): self.assertEqual(separate_trans("yīlù píng'ān"), ['yī lù', 'píng ān'])
def test_you_er_yuan(self): self.assertEqual(separate_trans("yòu'éryuán"), ["yòu ér yuán"])
def test_ungrouped(self): with patch('chinese.transcribe.config', {'transcription': 'Pinyin'}): self.assertEqual( separate_trans('hěn gāoxìng', grouped=False), ['hěn', 'gāo', 'xìng'], )
def test_multisyllabic_words(self): with patch('chinese.transcribe.config', {'transcription': 'Pinyin'}): self.assertEqual(separate_trans('túshūguǎn'), ['tú shū guǎn'])
def test_muliple_words(self): with patch('chinese.transcribe.config', {'transcription': 'Pinyin'}): self.assertEqual(separate_trans('hěn gāoxìng'), ['hěn', 'gāo xìng'])
def test_tone_number(self): with patch('chinese.transcribe.config', {'transcription': 'Pinyin'}): self.assertEqual(separate_trans('xian4zai4'), ['xian4 zai4'])
def test_tone_mark(self): with patch('chinese.transcribe.config', {'transcription': 'Pinyin'}): self.assertEqual(separate_trans('xiànzài'), ['xiàn zài'])