class TestMicVoiceEngine(unittest.TestCase): """ """ def setUp(self): self.mic = Mic() def atest_say(self): """ 测试获取语音 :return: """ self.mic.say('你好柯良妹') def test_listen(self): """ 测试监听和语音识别 :return: """ r = self.mic.listen( '/Volumes/MacintoshHD/WorkHub/PycharmProjects/dingdang-robot/data/cache/wave/tts_1e40530cfbaab369b7315621429f8f6b.wav' ) print(r) if __name__ == '__main__': logger.init(info=True) unittest.main()
import os os.sys.path.append(os.path.join(os.path.dirname(__file__), '../')) from src.components import logger import logging import json import wave import time from src.config.path import CACHE_WAVE_PATH from src.components.dingtalk import DingRobot class TestDingtalk(unittest.TestCase): """ 函数计算单元测试 """ def setUp(self): pass def test_dingtalk_handle(self): DingRobot.dingtalk_handle('ip地址发送到钉钉', '11111') def atest_send_message(self): res = DingRobot.send_message(title='## 撒地方\n阿斯蒂芬', markdown_content='## 撒地方\n阿斯蒂芬') assert res is True if __name__ == '__main__': logger.init(info=True, debug=True) unittest.main()