fix(test): update play_beep test to match polling-based implementation
play_beep was changed from sd.wait() to a poll loop + sd.stop() in 302e1fe but the test was not updated. Now asserts sd.stop() instead of sd.wait().
This commit is contained in:
parent
8b57a3cb7e
commit
eec04d180a
1 changed files with 6 additions and 1 deletions
|
|
@ -438,10 +438,15 @@ class TestPlayBeep:
|
||||||
|
|
||||||
from tools.voice_mode import play_beep
|
from tools.voice_mode import play_beep
|
||||||
|
|
||||||
|
# play_beep uses polling (get_stream) + sd.stop() instead of sd.wait()
|
||||||
|
mock_stream = MagicMock()
|
||||||
|
mock_stream.active = False
|
||||||
|
mock_sd.get_stream.return_value = mock_stream
|
||||||
|
|
||||||
play_beep(frequency=880, duration=0.1, count=1)
|
play_beep(frequency=880, duration=0.1, count=1)
|
||||||
|
|
||||||
mock_sd.play.assert_called_once()
|
mock_sd.play.assert_called_once()
|
||||||
mock_sd.wait.assert_called_once()
|
mock_sd.stop.assert_called()
|
||||||
# Verify audio data is int16 numpy array
|
# Verify audio data is int16 numpy array
|
||||||
audio_arg = mock_sd.play.call_args[0][0]
|
audio_arg = mock_sd.play.call_args[0][0]
|
||||||
assert audio_arg.dtype == np.int16
|
assert audio_arg.dtype == np.int16
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue