tests: try to use default SleepFrame time
This commit is contained in:
@@ -53,9 +53,9 @@ class TestDTMFAggregator(unittest.IsolatedAsyncioTestCase):
|
|||||||
frames_to_send = [
|
frames_to_send = [
|
||||||
InputDTMFFrame(button=KeypadEntry.ONE),
|
InputDTMFFrame(button=KeypadEntry.ONE),
|
||||||
InputDTMFFrame(button=KeypadEntry.TWO),
|
InputDTMFFrame(button=KeypadEntry.TWO),
|
||||||
SleepFrame(sleep=0.2), # This should trigger timeout
|
SleepFrame(), # This should trigger timeout
|
||||||
InputDTMFFrame(button=KeypadEntry.THREE),
|
InputDTMFFrame(button=KeypadEntry.THREE),
|
||||||
SleepFrame(sleep=0.2), # This should trigger another timeout
|
SleepFrame(), # This should trigger another timeout
|
||||||
]
|
]
|
||||||
expected_down_frames = [
|
expected_down_frames = [
|
||||||
InputDTMFFrame,
|
InputDTMFFrame,
|
||||||
@@ -86,10 +86,10 @@ class TestDTMFAggregator(unittest.IsolatedAsyncioTestCase):
|
|||||||
InputDTMFFrame(button=KeypadEntry.ONE),
|
InputDTMFFrame(button=KeypadEntry.ONE),
|
||||||
InputDTMFFrame(button=KeypadEntry.TWO),
|
InputDTMFFrame(button=KeypadEntry.TWO),
|
||||||
InputDTMFFrame(button=KeypadEntry.POUND), # First sequence
|
InputDTMFFrame(button=KeypadEntry.POUND), # First sequence
|
||||||
SleepFrame(sleep=0.1),
|
SleepFrame(),
|
||||||
InputDTMFFrame(button=KeypadEntry.FOUR),
|
InputDTMFFrame(button=KeypadEntry.FOUR),
|
||||||
InputDTMFFrame(button=KeypadEntry.FIVE),
|
InputDTMFFrame(button=KeypadEntry.FIVE),
|
||||||
SleepFrame(sleep=0.3), # Second sequence via timeout
|
SleepFrame(), # Second sequence via timeout
|
||||||
]
|
]
|
||||||
expected_down_frames = [
|
expected_down_frames = [
|
||||||
InputDTMFFrame,
|
InputDTMFFrame,
|
||||||
@@ -120,7 +120,7 @@ class TestDTMFAggregator(unittest.IsolatedAsyncioTestCase):
|
|||||||
frames_to_send = [
|
frames_to_send = [
|
||||||
InputDTMFFrame(button=KeypadEntry.ONE),
|
InputDTMFFrame(button=KeypadEntry.ONE),
|
||||||
InputDTMFFrame(button=KeypadEntry.TWO),
|
InputDTMFFrame(button=KeypadEntry.TWO),
|
||||||
SleepFrame(sleep=0.1), # Allow time for aggregation
|
SleepFrame(), # Allow time for aggregation
|
||||||
EndFrame(),
|
EndFrame(),
|
||||||
]
|
]
|
||||||
expected_down_frames = [
|
expected_down_frames = [
|
||||||
|
|||||||
@@ -124,14 +124,14 @@ class TestSTTMuteFilter(unittest.IsolatedAsyncioTestCase):
|
|||||||
frames_to_send = [
|
frames_to_send = [
|
||||||
# Bot speaking - should mute
|
# Bot speaking - should mute
|
||||||
BotStartedSpeakingFrame(),
|
BotStartedSpeakingFrame(),
|
||||||
SleepFrame(sleep=0.1), # Wait for StartedSpeaking to process
|
SleepFrame(), # Wait for StartedSpeaking to process
|
||||||
InterimTranscriptionFrame(
|
InterimTranscriptionFrame(
|
||||||
user_id="user1", text="This should be suppressed", timestamp="1234567890"
|
user_id="user1", text="This should be suppressed", timestamp="1234567890"
|
||||||
),
|
),
|
||||||
TranscriptionFrame(
|
TranscriptionFrame(
|
||||||
user_id="user1", text="This should be suppressed", timestamp="1234567890"
|
user_id="user1", text="This should be suppressed", timestamp="1234567890"
|
||||||
),
|
),
|
||||||
SleepFrame(sleep=0.1), # Wait for transcription frames to queue
|
SleepFrame(), # Wait for transcription frames to queue
|
||||||
BotStoppedSpeakingFrame(),
|
BotStoppedSpeakingFrame(),
|
||||||
# Bot not speaking - should pass through
|
# Bot not speaking - should pass through
|
||||||
InterimTranscriptionFrame(
|
InterimTranscriptionFrame(
|
||||||
|
|||||||
@@ -129,13 +129,13 @@ class TestUserTranscriptProcessor(unittest.IsolatedAsyncioTestCase):
|
|||||||
# Create test frames simulating bot speaking multiple text chunks
|
# Create test frames simulating bot speaking multiple text chunks
|
||||||
frames_to_send = [
|
frames_to_send = [
|
||||||
BotStartedSpeakingFrame(),
|
BotStartedSpeakingFrame(),
|
||||||
SleepFrame(sleep=0.1), # Wait for StartedSpeaking to process
|
SleepFrame(), # Wait for StartedSpeaking to process
|
||||||
TTSTextFrame(text="Hello"),
|
TTSTextFrame(text="Hello"),
|
||||||
TTSTextFrame(text="world!"),
|
TTSTextFrame(text="world!"),
|
||||||
TTSTextFrame(text="How"),
|
TTSTextFrame(text="How"),
|
||||||
TTSTextFrame(text="are"),
|
TTSTextFrame(text="are"),
|
||||||
TTSTextFrame(text="you?"),
|
TTSTextFrame(text="you?"),
|
||||||
SleepFrame(sleep=0.1), # Wait for text frames to queue
|
SleepFrame(), # Wait for text frames to queue
|
||||||
BotStoppedSpeakingFrame(),
|
BotStoppedSpeakingFrame(),
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -194,7 +194,7 @@ class TestUserTranscriptProcessor(unittest.IsolatedAsyncioTestCase):
|
|||||||
|
|
||||||
frames_to_send = [
|
frames_to_send = [
|
||||||
BotStartedSpeakingFrame(),
|
BotStartedSpeakingFrame(),
|
||||||
SleepFrame(sleep=0.1),
|
SleepFrame(),
|
||||||
TTSTextFrame(text=""), # Empty text
|
TTSTextFrame(text=""), # Empty text
|
||||||
TTSTextFrame(text=" "), # Just whitespace
|
TTSTextFrame(text=" "), # Just whitespace
|
||||||
TTSTextFrame(text="\n"), # Just newline
|
TTSTextFrame(text="\n"), # Just newline
|
||||||
@@ -234,16 +234,16 @@ class TestUserTranscriptProcessor(unittest.IsolatedAsyncioTestCase):
|
|||||||
# Simulate bot being interrupted mid-sentence
|
# Simulate bot being interrupted mid-sentence
|
||||||
frames_to_send = [
|
frames_to_send = [
|
||||||
BotStartedSpeakingFrame(),
|
BotStartedSpeakingFrame(),
|
||||||
SleepFrame(sleep=0.1),
|
SleepFrame(),
|
||||||
TTSTextFrame(text="Hello"),
|
TTSTextFrame(text="Hello"),
|
||||||
TTSTextFrame(text="world!"),
|
TTSTextFrame(text="world!"),
|
||||||
SleepFrame(sleep=0.1),
|
SleepFrame(),
|
||||||
StartInterruptionFrame(), # User interrupts here
|
StartInterruptionFrame(), # User interrupts here
|
||||||
SleepFrame(sleep=0.1),
|
SleepFrame(),
|
||||||
BotStartedSpeakingFrame(),
|
BotStartedSpeakingFrame(),
|
||||||
TTSTextFrame(text="New"),
|
TTSTextFrame(text="New"),
|
||||||
TTSTextFrame(text="response"),
|
TTSTextFrame(text="response"),
|
||||||
SleepFrame(sleep=0.1),
|
SleepFrame(),
|
||||||
BotStoppedSpeakingFrame(),
|
BotStoppedSpeakingFrame(),
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -298,7 +298,7 @@ class TestUserTranscriptProcessor(unittest.IsolatedAsyncioTestCase):
|
|||||||
|
|
||||||
frames_to_send = [
|
frames_to_send = [
|
||||||
BotStartedSpeakingFrame(),
|
BotStartedSpeakingFrame(),
|
||||||
SleepFrame(sleep=0.1),
|
SleepFrame(),
|
||||||
TTSTextFrame(text="Hello"),
|
TTSTextFrame(text="Hello"),
|
||||||
TTSTextFrame(text="world"),
|
TTSTextFrame(text="world"),
|
||||||
# Pipeline ends here; run_test will automatically send EndFrame
|
# Pipeline ends here; run_test will automatically send EndFrame
|
||||||
@@ -337,10 +337,10 @@ class TestUserTranscriptProcessor(unittest.IsolatedAsyncioTestCase):
|
|||||||
|
|
||||||
frames_to_send = [
|
frames_to_send = [
|
||||||
BotStartedSpeakingFrame(),
|
BotStartedSpeakingFrame(),
|
||||||
SleepFrame(sleep=0.1),
|
SleepFrame(),
|
||||||
TTSTextFrame(text="Hello"),
|
TTSTextFrame(text="Hello"),
|
||||||
TTSTextFrame(text="world"),
|
TTSTextFrame(text="world"),
|
||||||
SleepFrame(sleep=0.1), # Ensure messages are processed
|
SleepFrame(), # Ensure messages are processed
|
||||||
CancelFrame(),
|
CancelFrame(),
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -400,7 +400,7 @@ class TestUserTranscriptProcessor(unittest.IsolatedAsyncioTestCase):
|
|||||||
# Test assistant processor
|
# Test assistant processor
|
||||||
frames_to_send = [
|
frames_to_send = [
|
||||||
BotStartedSpeakingFrame(),
|
BotStartedSpeakingFrame(),
|
||||||
SleepFrame(sleep=0.1),
|
SleepFrame(),
|
||||||
TTSTextFrame(text="Assistant"),
|
TTSTextFrame(text="Assistant"),
|
||||||
TTSTextFrame(text="message"),
|
TTSTextFrame(text="message"),
|
||||||
BotStoppedSpeakingFrame(),
|
BotStoppedSpeakingFrame(),
|
||||||
@@ -440,7 +440,7 @@ class TestUserTranscriptProcessor(unittest.IsolatedAsyncioTestCase):
|
|||||||
# Test the specific pattern shared
|
# Test the specific pattern shared
|
||||||
frames_to_send = [
|
frames_to_send = [
|
||||||
BotStartedSpeakingFrame(),
|
BotStartedSpeakingFrame(),
|
||||||
SleepFrame(sleep=0.1),
|
SleepFrame(),
|
||||||
TTSTextFrame(text="Hello"),
|
TTSTextFrame(text="Hello"),
|
||||||
TTSTextFrame(text=" there"),
|
TTSTextFrame(text=" there"),
|
||||||
TTSTextFrame(text="!"),
|
TTSTextFrame(text="!"),
|
||||||
|
|||||||
Reference in New Issue
Block a user