From d1ee851a65a7be3c4a5a6f22b8c0f83b70a1e8bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Tue, 11 Feb 2025 22:12:48 -0800 Subject: [PATCH] tests: rename some variables to make things clearer --- tests/test_aggregators.py | 8 ++++---- tests/test_filters.py | 32 ++++++++++++++++---------------- tests/test_pipeline.py | 20 ++++++++++---------- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/tests/test_aggregators.py b/tests/test_aggregators.py index ab7210e49..48650977e 100644 --- a/tests/test_aggregators.py +++ b/tests/test_aggregators.py @@ -29,12 +29,12 @@ class TestSentenceAggregator(unittest.IsolatedAsyncioTestCase): for word in sentence.split(" "): frames_to_send.append(TextFrame(text=word + " ")) - expected_returned_frames = [TextFrame, TextFrame, TextFrame] + expected_down_frames = [TextFrame, TextFrame, TextFrame] (received_down, _) = await run_test( aggregator, frames_to_send=frames_to_send, - expected_down_frames=expected_returned_frames, + expected_down_frames=expected_down_frames, ) assert received_down[-3].text == "Hello, world. " assert received_down[-2].text == "How are you? " @@ -59,7 +59,7 @@ class TestGatedAggregator(unittest.IsolatedAsyncioTestCase): LLMFullResponseEndFrame(), ] - expected_returned_frames = [ + expected_down_frames = [ OutputImageRawFrame, LLMFullResponseStartFrame, TextFrame, @@ -72,5 +72,5 @@ class TestGatedAggregator(unittest.IsolatedAsyncioTestCase): (received_down, _) = await run_test( gated_aggregator, frames_to_send=frames_to_send, - expected_down_frames=expected_returned_frames, + expected_down_frames=expected_down_frames, ) diff --git a/tests/test_filters.py b/tests/test_filters.py index 9d3b0f003..a47903232 100644 --- a/tests/test_filters.py +++ b/tests/test_filters.py @@ -25,11 +25,11 @@ class TestIdentifyFilter(unittest.IsolatedAsyncioTestCase): async def test_identity(self): filter = IdentityFilter() frames_to_send = [UserStartedSpeakingFrame(), UserStoppedSpeakingFrame()] - expected_returned_frames = [UserStartedSpeakingFrame, UserStoppedSpeakingFrame] + expected_down_frames = [UserStartedSpeakingFrame, UserStoppedSpeakingFrame] await run_test( filter, frames_to_send=frames_to_send, - expected_down_frames=expected_returned_frames, + expected_down_frames=expected_down_frames, ) @@ -37,32 +37,32 @@ class TestFrameFilter(unittest.IsolatedAsyncioTestCase): async def test_text_frame(self): filter = FrameFilter(types=(TextFrame,)) frames_to_send = [TextFrame(text="Hello Pipecat!")] - expected_returned_frames = [TextFrame] + expected_down_frames = [TextFrame] await run_test( filter, frames_to_send=frames_to_send, - expected_down_frames=expected_returned_frames, + expected_down_frames=expected_down_frames, ) async def test_end_frame(self): filter = FrameFilter(types=(EndFrame,)) frames_to_send = [EndFrame()] - expected_returned_frames = [EndFrame] + expected_down_frames = [EndFrame] await run_test( filter, frames_to_send=frames_to_send, - expected_down_frames=expected_returned_frames, + expected_down_frames=expected_down_frames, send_end_frame=False, ) async def test_system_frame(self): filter = FrameFilter(types=()) frames_to_send = [UserStartedSpeakingFrame()] - expected_returned_frames = [UserStartedSpeakingFrame] + expected_down_frames = [UserStartedSpeakingFrame] await run_test( filter, frames_to_send=frames_to_send, - expected_down_frames=expected_returned_frames, + expected_down_frames=expected_down_frames, ) @@ -73,11 +73,11 @@ class TestFunctionFilter(unittest.IsolatedAsyncioTestCase): filter = FunctionFilter(filter=passthrough) frames_to_send = [TextFrame(text="Hello Pipecat!")] - expected_returned_frames = [TextFrame] + expected_down_frames = [TextFrame] await run_test( filter, frames_to_send=frames_to_send, - expected_down_frames=expected_returned_frames, + expected_down_frames=expected_down_frames, ) async def test_no_passthrough(self): @@ -86,11 +86,11 @@ class TestFunctionFilter(unittest.IsolatedAsyncioTestCase): filter = FunctionFilter(filter=no_passthrough) frames_to_send = [TextFrame(text="Hello Pipecat!")] - expected_returned_frames = [] + expected_down_frames = [] await run_test( filter, frames_to_send=frames_to_send, - expected_down_frames=expected_returned_frames, + expected_down_frames=expected_down_frames, ) @@ -98,11 +98,11 @@ class TestWakeCheckFilter(unittest.IsolatedAsyncioTestCase): async def test_no_wake_word(self): filter = WakeCheckFilter(wake_phrases=["Hey, Pipecat"]) frames_to_send = [TranscriptionFrame(user_id="test", text="Phrase 1", timestamp="")] - expected_returned_frames = [] + expected_down_frames = [] await run_test( filter, frames_to_send=frames_to_send, - expected_down_frames=expected_returned_frames, + expected_down_frames=expected_down_frames, ) async def test_wake_word(self): @@ -111,10 +111,10 @@ class TestWakeCheckFilter(unittest.IsolatedAsyncioTestCase): TranscriptionFrame(user_id="test", text="Hey, Pipecat", timestamp=""), TranscriptionFrame(user_id="test", text="Phrase 1", timestamp=""), ] - expected_returned_frames = [TranscriptionFrame, TranscriptionFrame] + expected_down_frames = [TranscriptionFrame, TranscriptionFrame] (received_down, _) = await run_test( filter, frames_to_send=frames_to_send, - expected_down_frames=expected_returned_frames, + expected_down_frames=expected_down_frames, ) assert received_down[-1].text == "Phrase 1" diff --git a/tests/test_pipeline.py b/tests/test_pipeline.py index caac89c11..0aff922b2 100644 --- a/tests/test_pipeline.py +++ b/tests/test_pipeline.py @@ -21,11 +21,11 @@ class TestPipeline(unittest.IsolatedAsyncioTestCase): pipeline = Pipeline([IdentityFilter()]) frames_to_send = [TextFrame(text="Hello from Pipecat!")] - expected_returned_frames = [TextFrame] + expected_down_frames = [TextFrame] await run_test( pipeline, frames_to_send=frames_to_send, - expected_down_frames=expected_returned_frames, + expected_down_frames=expected_down_frames, ) async def test_pipeline_multiple(self): @@ -36,22 +36,22 @@ class TestPipeline(unittest.IsolatedAsyncioTestCase): pipeline = Pipeline([identity1, identity2, identity3]) frames_to_send = [TextFrame(text="Hello from Pipecat!")] - expected_returned_frames = [TextFrame] + expected_down_frames = [TextFrame] await run_test( pipeline, frames_to_send=frames_to_send, - expected_down_frames=expected_returned_frames, + expected_down_frames=expected_down_frames, ) async def test_pipeline_start_metadata(self): pipeline = Pipeline([IdentityFilter()]) frames_to_send = [] - expected_returned_frames = [StartFrame] + expected_down_frames = [StartFrame] (received_down, _) = await run_test( pipeline, frames_to_send=frames_to_send, - expected_down_frames=expected_returned_frames, + expected_down_frames=expected_down_frames, ignore_start=False, start_metadata={"foo": "bar"}, ) @@ -63,11 +63,11 @@ class TestParallelPipeline(unittest.IsolatedAsyncioTestCase): pipeline = ParallelPipeline([IdentityFilter()]) frames_to_send = [TextFrame(text="Hello from Pipecat!")] - expected_returned_frames = [TextFrame] + expected_down_frames = [TextFrame] await run_test( pipeline, frames_to_send=frames_to_send, - expected_down_frames=expected_returned_frames, + expected_down_frames=expected_down_frames, ) async def test_parallel_multiple(self): @@ -75,11 +75,11 @@ class TestParallelPipeline(unittest.IsolatedAsyncioTestCase): pipeline = ParallelPipeline([IdentityFilter()], [IdentityFilter()]) frames_to_send = [TextFrame(text="Hello from Pipecat!")] - expected_returned_frames = [TextFrame] + expected_down_frames = [TextFrame] await run_test( pipeline, frames_to_send=frames_to_send, - expected_down_frames=expected_returned_frames, + expected_down_frames=expected_down_frames, )