diff --git a/tests/metagpt/exp_pool/test_context_builders/test_rolezero_context_builder.py b/tests/metagpt/exp_pool/test_context_builders/test_rolezero_context_builder.py index a95566ed1..b7182602d 100644 --- a/tests/metagpt/exp_pool/test_context_builders/test_rolezero_context_builder.py +++ b/tests/metagpt/exp_pool/test_context_builders/test_rolezero_context_builder.py @@ -25,31 +25,27 @@ class TestRoleZeroContextBuilder: async def test_build_with_experiences(self, context_builder, mocker): mocker.patch.object(BaseContextBuilder, "format_exps", return_value="Formatted experiences") mocker.patch.object(RoleZeroContextBuilder, "replace_example_content", return_value="Updated content") - req = [{"content": "Original content 1"}, {"content": "Original content exp part"}] + req = [{"content": "Original content 1"}] result = await context_builder.build(req=req) - assert result == [{"content": "Updated content"}, {"content": "Original content exp part"}] + assert result == [{"content": "Updated content"}] def test_replace_example_content(self, context_builder, mocker): mocker.patch.object(RoleZeroContextBuilder, "replace_content_between_markers", return_value="Replaced content") result = context_builder.replace_example_content("Original text", "New example content") assert result == "Replaced content" context_builder.replace_content_between_markers.assert_called_once_with( - "Original text", "# Example", "# Available Commands", "New example content" + "Original text", "# Example", "# Instruction", "New example content" ) def test_replace_content_between_markers(self): - text = "Start\n# Example\nOld content\n# Available Commands\nEnd" + text = "Start\n# Example\nOld content\n# Instruction\nEnd" new_content = "New content" - result = RoleZeroContextBuilder.replace_content_between_markers( - text, "# Example", "# Available Commands", new_content - ) - expected = "Start\n# Example\nNew content\n\n# Available Commands\nEnd" + result = RoleZeroContextBuilder.replace_content_between_markers(text, "# Example", "# Instruction", new_content) + expected = "Start\n# Example\nNew content\n\n# Instruction\nEnd" assert result == expected def test_replace_content_between_markers_no_match(self): text = "Start\nNo markers\nEnd" new_content = "New content" - result = RoleZeroContextBuilder.replace_content_between_markers( - text, "# Example", "# Available Commands", new_content - ) + result = RoleZeroContextBuilder.replace_content_between_markers(text, "# Example", "# Instruction", new_content) assert result == text diff --git a/tests/metagpt/exp_pool/test_serializers/test_role_zero.py b/tests/metagpt/exp_pool/test_serializers/test_role_zero.py index a168650fc..964443f29 100644 --- a/tests/metagpt/exp_pool/test_serializers/test_role_zero.py +++ b/tests/metagpt/exp_pool/test_serializers/test_role_zero.py @@ -30,9 +30,7 @@ class TestRoleZeroSerializer: {"role": "assistant", "content": "Some other content"}, last_item, ] - expected_output = json.dumps( - [{"role": "user", "content": "Command Editor.read executed: file_path=test.py"}, last_item] - ) + expected_output = json.dumps([{"role": "user", "content": "Command Editor.read executed: file_path=test.py"}]) assert serializer.serialize_req(req=req) == expected_output def test_filter_req(self, serializer: RoleZeroSerializer):