test.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:tts-server 作者: langsiji 项目源码 文件源码
def test_voice_base64_data(self):
        if not options.cache_dir: return
        response = self.fetch("/tts?text=hello")
        status = escape.json_decode(response.body)
        self.assertEqual(response.code, 200)
        self.assertTrue(status["success"])
        self.assertGreater(len(status["data"]["file"]), 0)
        # ??????????????????
        self.assertEqual(status["data"]["voice"], options.voice)
        voicedata = base64.b64decode(status["data"]["sound_base64"])
        with open(os.path.join(options.cache_dir,
                               status["data"]["file"]), "rb") as f:
            filedata = f.read()
        self.assertEqual(filedata, voicedata)

    # ????cache??
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号