tests: fix unit tests

This commit is contained in:
Aleix Conchillo Flaqué
2025-08-18 16:17:51 -07:00
parent 75a6ee839b
commit 4015aedb86
3 changed files with 9 additions and 9 deletions

View File

@@ -36,7 +36,7 @@ class SleepFrame(SystemFrame):
sleep: Duration to sleep in seconds before processing the next frame.
"""
sleep: float = 0.1
sleep: float = 0.2
class HeartbeatsObserver(BaseObserver):
@@ -100,7 +100,7 @@ class QueuedFrameProcessor(FrameProcessor):
queue_direction: The direction of frames to capture (UPSTREAM or DOWNSTREAM).
ignore_start: Whether to ignore StartFrames when capturing.
"""
super().__init__()
super().__init__(enable_direct_mode=True)
self._queue = queue
self._queue_direction = queue_direction
self._ignore_start = ignore_start

View File

@@ -102,8 +102,8 @@ class BaseTestUserContextAggregator:
]
expected_down_frames = [
UserStartedSpeakingFrame,
UserStoppedSpeakingFrame,
*self.EXPECTED_CONTEXT_FRAMES,
UserStoppedSpeakingFrame,
]
await run_test(
aggregator,
@@ -127,8 +127,8 @@ class BaseTestUserContextAggregator:
]
expected_down_frames = [
UserStartedSpeakingFrame,
UserStoppedSpeakingFrame,
*self.EXPECTED_CONTEXT_FRAMES,
UserStoppedSpeakingFrame,
]
await run_test(
aggregator,
@@ -158,8 +158,8 @@ class BaseTestUserContextAggregator:
UserStartedSpeakingFrame,
UserStoppedSpeakingFrame,
UserStartedSpeakingFrame,
UserStoppedSpeakingFrame,
*self.EXPECTED_CONTEXT_FRAMES,
UserStoppedSpeakingFrame,
]
await run_test(
aggregator,
@@ -298,8 +298,8 @@ class BaseTestUserContextAggregator:
expected_down_frames = [
SpeechControlParamsFrame,
UserStartedSpeakingFrame,
UserStoppedSpeakingFrame,
*self.EXPECTED_CONTEXT_FRAMES,
UserStoppedSpeakingFrame,
*self.EXPECTED_CONTEXT_FRAMES,
]
await run_test(

View File

@@ -151,8 +151,8 @@ class TestUserTranscriptProcessor(unittest.IsolatedAsyncioTestCase):
TTSTextFrame,
TTSTextFrame,
TTSTextFrame,
BotStoppedSpeakingFrame,
TranscriptionUpdateFrame,
BotStoppedSpeakingFrame,
]
# Run test
@@ -179,7 +179,7 @@ class TestUserTranscriptProcessor(unittest.IsolatedAsyncioTestCase):
self.assertIsNotNone(message.timestamp)
# All frames should be passed through in order, with update at end
downstream_update = cast(TranscriptionUpdateFrame, received_frames[-1])
downstream_update = cast(TranscriptionUpdateFrame, received_frames[-2])
self.assertEqual(downstream_update.messages[0].content, "Hello world! How are you?")
async def test_empty_text_handling(self):
@@ -257,8 +257,8 @@ class TestUserTranscriptProcessor(unittest.IsolatedAsyncioTestCase):
BotStartedSpeakingFrame,
TTSTextFrame, # "New"
TTSTextFrame, # "response"
BotStoppedSpeakingFrame,
TranscriptionUpdateFrame, # Second message
BotStoppedSpeakingFrame,
]
# Run test