mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2026-04-24 09:44:10 +08:00
[Optimization]Unified data processing for online and offline (#6891)
* remove process_request * fix chat * fix unit test * remove process response * fix unit test * fix offline decode * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * fix sampling_params --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -264,33 +264,6 @@ class TestErnie4_5VLProcessorProcessResponseDictStreaming(unittest.TestCase):
|
||||
processor._check_mm_limits(mm_data)
|
||||
self.assertIn("Too many image items", str(context.exception))
|
||||
|
||||
def test_process_request(self):
|
||||
"""Test process_request method"""
|
||||
from fastdeploy.engine.request import Request
|
||||
|
||||
# Mock the process_request_dict method
|
||||
self.processor.process_request_dict = MagicMock()
|
||||
|
||||
# Create a mock Request object
|
||||
mock_request = MagicMock(spec=Request)
|
||||
mock_request.to_dict.return_value = {"messages": [{"role": "user", "content": "Hello"}]}
|
||||
|
||||
# Mock Request.from_dict to return a mock request
|
||||
with patch.object(Request, "from_dict") as mock_from_dict:
|
||||
mock_result_request = MagicMock(spec=Request)
|
||||
mock_from_dict.return_value = mock_result_request
|
||||
|
||||
self.processor.process_request(mock_request, max_model_len=100, chat_template_kwargs={"key": "value"})
|
||||
|
||||
# Verify to_dict was called
|
||||
mock_request.to_dict.assert_called_once()
|
||||
|
||||
# Verify process_request_dict was called
|
||||
self.processor.process_request_dict.assert_called_once()
|
||||
|
||||
# Verify from_dict was called
|
||||
mock_from_dict.assert_called_once()
|
||||
|
||||
def test_get_pad_id(self):
|
||||
"""Test get_pad_id method"""
|
||||
with patch.object(Ernie4_5_VLProcessor, "__init__", return_value=None):
|
||||
|
||||
Reference in New Issue
Block a user