コード例 #1
0
 def test_pinyin1(self):
   """Add a new sense to a DictionaryEntry object"""
   trad = '說'
   hwid = '1'
   simplified = '说'
   pinyin = 'shuō'
   english = 'say'
   sense = cndict_types.WordSense(simplified, trad, pinyin, english)
   entry = cndict_types.DictionaryEntry(trad, [sense], hwid)
   self.assertEqual(entry.pinyin, pinyin)
コード例 #2
0
 def test_english2(self):
   """Add a new sense to a DictionaryEntry object"""
   trad = '說'
   hwid = '1'
   simplified = '说'
   pinyin = 'shuō'
   english1 = 'say'
   sense1 = cndict_types.WordSense(simplified, trad, pinyin, english1)
   english2 = 'explain'
   sense2 = cndict_types.WordSense(simplified, trad, pinyin, english2)
   entry = cndict_types.DictionaryEntry(trad, [sense1, sense2], hwid)
   self.assertEqual(entry.english, '1. say; 2. explain')
コード例 #3
0
 def test_add_word_sense(self):
   """Add a new sense to a DictionaryEntry object"""
   trad = '說'
   hwid = '1'
   entry = cndict_types.DictionaryEntry(trad, [], hwid)
   simplified = '说'
   pinyin = 'shuō'
   english = 'say'
   sense = cndict_types.WordSense(simplified, trad, pinyin, english)
   entry.add_word_sense(sense)
   senses = entry.senses
   self.assertEqual(len(senses), 1)
コード例 #4
0
 def test_pinyin2(self):
   """Add a new sense to a DictionaryEntry object"""
   trad = '說'
   hwid = '1'
   simplified = '说'
   pinyin1 = 'shuō'
   english1 = 'say'
   sense1 = cndict_types.WordSense(simplified, trad, pinyin1, english1)
   pinyin2 = 'yuè'
   english2 = 'speak'
   sense2 = cndict_types.WordSense(simplified, trad, pinyin2, english2)
   'yuè'
   entry = cndict_types.DictionaryEntry(trad, [sense1, sense2], hwid)
   self.assertEqual(entry.pinyin, 'shuō, yuè')