示例#1
0
class BingDictTest(unittest.TestCase):
    def setUp(self):
        self.keywords = ['addicted', 'hello', 'welcome', 'it\'s', '你',
                         'cancer']
        from DictC.BingDict import BingDict
        self.BingDict = BingDict
        self.bing = BingDict()

    def test_fetchSuggestion(self):
        keywords = [
            '你', "it's", 'hello'
        ]
        for keyword in keywords:
            data = self.BingDict.fetchSuggestion(keyword)
            self.assertTrue(data)

        self.assertEqual(10, len(data))
        self.assertTupleEqual(
            (u'hello', u'你好;您好;哈喽;喂,表示问候,打招呼或接电话时'),
            data[0]
        )

    def test_getOutput(self):
        for keyword in self.keywords:
            self.bing.setKeyword(keyword)
            status, content = self.bing.getOutput()
            self.assertTrue(status)
示例#2
0
 def setUp(self):
     self.keywords = ['addicted', 'hello', 'welcome', 'it\'s', '你',
                      'cancer']
     from DictC.BingDict import BingDict
     self.BingDict = BingDict
     self.bing = BingDict()