def test_numbers(self): """Test the get/get_consonant/get_vowel function for arabic numbsers """ self.assertEqual(pinyin.get('2'), u'er') self.assertEqual(pinyin.get('1234567890'), u'yiersansiwuliuqibajiuling') self.assertEqual(pinyin.get_consonant('1'), u'y') self.assertEqual(pinyin.get_vowel('1'), u'i')
def test_get_consonant(self): """Test function pinyin.get_consonant """ self.assertEqual(pinyin.get_consonant('ÄãºÃ'), u'n h') self.assertEqual(pinyin.get_consonant('ÄãºÃÂð?'), u'n h m ?') self.assertEqual(pinyin.get_consonant('ÄãºÃÂð£¿'), u'n h m £¿') self.assertEqual(pinyin.get_consonant('ÎÒ°®Äã'), 'w n') self.assertEqual(pinyin.get_consonant('°®'), u'') self.assertEqual(pinyin.get_consonant('ÄãºÃ'), u'n h') self.assertEqual(pinyin.get_consonant('ÄãºÃ', "-"), u'n-h') self.assertEqual(pinyin.get_consonant('ÄãºÃÂð?', "-"), u'n-h-m-?') self.assertEqual(pinyin.get_consonant('ÄãºÃÂð£¿', "-"), u'n-h-m-£¿')
def test_mixed_chinese_english_input(self): """Test the get/get_consonant/get_vowel function for mixed chinese english string """ self.assertEqual(pinyin.get('hiÄãºÃ'), u'hinihao') self.assertEqual(pinyin.get_consonant('hiÄãºÃ'), u'h i n h') self.assertEqual(pinyin.get_vowel('hiÄãºÃ'), u'h i i ao')