def test_process_llm_request_gemini_2_model_with_existing_tools(
    built_in_executor: BuiltInCodeExecutor,
):
  """Tests processing when llm_request.config.tools already has tools for Gemini 2."""
  existing_tool = types.Tool(
      function_declarations=[
          types.FunctionDeclaration(name="test_func", description="A test func")
      ]
  )
  llm_request = LlmRequest(
      model="gemini-2.0-flash-001",
      config=types.GenerateContentConfig(tools=[existing_tool]),
  )
  built_in_executor.process_llm_request(llm_request)
  assert len(llm_request.config.tools) == 2
  assert existing_tool in llm_request.config.tools
  assert (
      types.Tool(code_execution=types.ToolCodeExecution())
      in llm_request.config.tools
  )
Tests processing when llm_request.config.tools already has tools for Gemini 2.
tests/unittests/code_executors/test_built_in_code_executor.py