コード例 #1
0
 def setUp(self):
     self.translate = YandexDictionary("trnsl.1.1.20130421T140201Z.323e508a"
                                       "33e9d84b.f1e0d9ca9bcd0a00b0ef71d82e6cf4158183d09e")
コード例 #2
0
 def test_without_key(self):
     with self.assertRaises(YandexDictionaryException,
                            msg="Please, provide key for "
                                "Yandex.Translate API: "
                                "https://translate.yandex.ru/apikeys"):
         translate = YandexDictionary()
コード例 #3
0
 def test_invalid_key(self):
     with self.assertRaises(YandexDictionaryException, msg="ERR_KEY_INVALID"):
         translate = YandexDictionary("my-invalid-key")
         languages = translate.langs()
コード例 #4
0
 def test_blocked_key(self):
     translate = YandexDictionary("trnsl.1.1.20130723T112255Z.cfcd2b1ebae9f"
                                  "ff1.86f3d1de3621e69b8c432fcdd6803bb87ef0e963")
     with self.assertRaises(YandexDictionaryException, msg="ERR_KEY_BLOCKED"):
         languages = translate.detect("Hello!")