test cleanup
This commit is contained in:
@@ -9,9 +9,9 @@ from pipecat.processors.aggregators.gated import GatedAggregator
|
||||
from pipecat.pipeline.parallel_pipeline import ParallelPipeline
|
||||
|
||||
from pipecat.frames.frames import (
|
||||
AudioFrame,
|
||||
AudioRawFrame,
|
||||
EndFrame,
|
||||
ImageFrame,
|
||||
ImageRawFrame,
|
||||
LLMResponseEndFrame,
|
||||
LLMResponseStartFrame,
|
||||
Frame,
|
||||
@@ -45,26 +45,26 @@ class TestDailyFrameAggregators(unittest.IsolatedAsyncioTestCase):
|
||||
async def test_gated_accumulator(self):
|
||||
gated_aggregator = GatedAggregator(
|
||||
gate_open_fn=lambda frame: isinstance(
|
||||
frame, ImageFrame), gate_close_fn=lambda frame: isinstance(
|
||||
frame, ImageRawFrame), gate_close_fn=lambda frame: isinstance(
|
||||
frame, LLMResponseStartFrame), start_open=False, )
|
||||
|
||||
frames = [
|
||||
LLMResponseStartFrame(),
|
||||
TextFrame("Hello, "),
|
||||
TextFrame("world."),
|
||||
AudioFrame(b"hello"),
|
||||
ImageFrame(b"image", (0, 0)),
|
||||
AudioFrame(b"world"),
|
||||
AudioRawFrame(b"hello", 1, 1),
|
||||
ImageRawFrame(b"image", (0, 0)),
|
||||
AudioRawFrame(b"world", 1, 1),
|
||||
LLMResponseEndFrame(),
|
||||
]
|
||||
|
||||
expected_output_frames = [
|
||||
ImageFrame(b"image", (0, 0)),
|
||||
ImageRawFrame(b"image", (0, 0)),
|
||||
LLMResponseStartFrame(),
|
||||
TextFrame("Hello, "),
|
||||
TextFrame("world."),
|
||||
AudioFrame(b"hello"),
|
||||
AudioFrame(b"world"),
|
||||
AudioRawFrame(b"hello", 1, 1),
|
||||
AudioRawFrame(b"world", 1, 1),
|
||||
LLMResponseEndFrame(),
|
||||
]
|
||||
for frame in frames:
|
||||
|
||||
@@ -2,7 +2,7 @@ import asyncio
|
||||
import unittest
|
||||
from unittest.mock import AsyncMock, patch, Mock
|
||||
|
||||
from pipecat.frames.frames import AudioFrame, EndFrame, TextFrame, TTSEndFrame, TTSStartFrame
|
||||
from pipecat.frames.frames import AudioRawFrame, EndFrame, TextFrame, TTSStoppedFrame, TTSStartedFrame
|
||||
from pipecat.pipeline.pipeline import Pipeline
|
||||
from pipecat.transports.websocket_transport import WebSocketFrameProcessor, WebsocketTransport
|
||||
|
||||
@@ -52,10 +52,10 @@ class TestWebSocketTransportService(unittest.IsolatedAsyncioTestCase):
|
||||
processor = WebSocketFrameProcessor(audio_frame_size=4)
|
||||
|
||||
source_frames = [
|
||||
TTSStartFrame(),
|
||||
AudioFrame(b"1234"),
|
||||
AudioFrame(b"5678"),
|
||||
TTSEndFrame(),
|
||||
TTSStartedFrame(),
|
||||
AudioRawFrame(b"1234", 1, 1),
|
||||
AudioRawFrame(b"5678", 1, 1),
|
||||
TTSStoppedFrame(),
|
||||
TextFrame("hello world")
|
||||
]
|
||||
|
||||
@@ -65,9 +65,9 @@ class TestWebSocketTransportService(unittest.IsolatedAsyncioTestCase):
|
||||
frames.append(output_frame)
|
||||
|
||||
self.assertEqual(len(frames), 3)
|
||||
self.assertIsInstance(frames[0], AudioFrame)
|
||||
self.assertIsInstance(frames[0], AudioRawFrame)
|
||||
self.assertEqual(frames[0].data, b"1234")
|
||||
self.assertIsInstance(frames[1], AudioFrame)
|
||||
self.assertIsInstance(frames[1], AudioRawFrame)
|
||||
self.assertEqual(frames[1].data, b"5678")
|
||||
self.assertIsInstance(frames[2], TextFrame)
|
||||
self.assertEqual(frames[2].text, "hello world")
|
||||
Reference in New Issue
Block a user