2022-12-30 13:06:57 +00:00
|
|
|
"""Integration test for Google Search API Wrapper."""
|
|
|
|
from langchain.utilities.google_search import GoogleSearchAPIWrapper
|
|
|
|
|
|
|
|
|
|
|
|
def test_call() -> None:
|
|
|
|
"""Test that call gives the correct answer."""
|
|
|
|
search = GoogleSearchAPIWrapper()
|
|
|
|
output = search.run("What was Obama's first name?")
|
|
|
|
assert "Barack Hussein Obama II" in output
|
2023-02-17 21:04:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_no_result_call() -> None:
|
|
|
|
"""Test that call gives no result."""
|
|
|
|
search = GoogleSearchAPIWrapper()
|
|
|
|
output = search.run(
|
|
|
|
"NORESULTCALL_NORESULTCALL_NORESULTCALL_NORESULTCALL_NORESULTCALL_NORESULTCALL"
|
|
|
|
)
|
|
|
|
print(type(output))
|
|
|
|
assert "No good Google Search Result was found" == output
|