def test_main(resource, monkeypatch, capsys): monkeypatch.setattr(transcribe_streaming.pyaudio, 'PyAudio', MockPyAudio(resource('quit.raw'))) transcribe_streaming.main() out, err = capsys.readouterr() assert re.search(r'quit', out, re.DOTALL | re.I)
def test_main(monkeypatch, capsys): monkeypatch.setattr(transcribe_streaming.pyaudio, 'PyAudio', MockPyAudio(os.path.join(RESOURCES, 'quit.raw'))) transcribe_streaming.main() out, err = capsys.readouterr() assert re.search(r'quit', out, re.DOTALL | re.I)
def test_main(resource, monkeypatch, capsys): monkeypatch.setattr( transcribe_streaming.pyaudio, 'PyAudio', MockPyAudio(resource('quit.raw'))) transcribe_streaming.main() out, err = capsys.readouterr() assert re.search(r'transcript.*"quit"', out, re.DOTALL | re.I)
def test_main(resource, monkeypatch, capsys): monkeypatch.setattr( transcribe_streaming, 'record_audio', mock_audio_stream(resource('quit.raw'))) monkeypatch.setattr(transcribe_streaming, 'DEADLINE_SECS', 30) transcribe_streaming.main() out, err = capsys.readouterr() assert re.search(r'transcript.*"quit"', out, re.DOTALL | re.I)