def test_search_with_verbose(mock_print, mock_valyu):
    """Test search method with verbose=True."""
    # Mock the Valyu client and response
    mock_client = Mock()
    mock_valyu.return_value = mock_client

    # Create mock result object
    mock_result = Mock()
    mock_result.content = "Verbose test content"
    mock_result.title = "Verbose test title"
    mock_result.url = "https://verbose-test.com"
    mock_result.source = "verbose_source"
    mock_result.price = 2.0
    mock_result.length = 200
    mock_result.data_type = "text"
    mock_result.relevance_score = 0.9

    # Mock response object
    mock_response = Mock()
    mock_response.results = [mock_result]
    mock_client.search.return_value = mock_response

    tool = ValyuToolSpec(api_key="test_key", verbose=True)

    # Test search with verbose output
    documents = tool.search(query="verbose test query", max_price=25.0)

    # Verify verbose print was called
    mock_print.assert_called_once_with(f"[Valyu Tool] Response: {mock_response}")

    # Verify document creation
    assert len(documents) == 1
    assert documents[0].text == "Verbose test content"
Test search method with verbose=True.
llama-index-integrations/tools/llama-index-tools-valyu/tests/test_tools_valyu.py