Skip to content

The agent engineering platform.

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

skspark52a3e8a261c8
diff --git a/libs/langchain/tests/integration_tests/utilities/test_bing_search.py b/libs/langchain/tests/integration_tests/utilities/test_bing_search.py
new file mode 100644
index 0000000000..72b2d166fd
--- /dev/null
+++ b/libs/langchain/tests/integration_tests/utilities/test_bing_search.py
@@ -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