Add integration TCs on bing search (#8068) (#10021)

## Description
Added integration TCs on bing search utility

## Issue
#8068 

## Dependencies
None
This commit is contained in:
skspark 2023-08-31 16:34:06 +09:00 committed by GitHub
parent e2e05ad89e
commit 52a3e8a261
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,19 @@
"""Integration test for Bing Search API Wrapper."""
from langchain.utilities.bing_search import BingSearchAPIWrapper
def test_call() -> None:
"""Test that call gives the correct answer."""
search = BingSearchAPIWrapper()
output = search.run("Obama's first name")
assert "Barack Hussein Obama" in output
def test_results() -> None:
"""Test that call gives the correct answer."""
search = BingSearchAPIWrapper()
results = search.results("Obama's first name", num_results=5)
result_contents = "\n".join(
f"{result['title']}: {result['snippet']}" for result in results
)
assert "Barack Hussein Obama" in result_contents