langchain/libs/community/tests/integration_tests/utilities/test_stackexchange.py
Christophe Bornet ada740b5b9
community: Add ruff rule PGH003 (#30812)
See https://docs.astral.sh/ruff/rules/blanket-type-ignore/

---------

Co-authored-by: Chester Curme <chester.curme@gmail.com>
2025-04-14 02:32:13 +00:00

25 lines
792 B
Python

"""Integration test for Stack Exchange."""
from langchain_community.utilities import StackExchangeAPIWrapper
def test_call() -> None:
"""Test that call runs."""
stackexchange = StackExchangeAPIWrapper()
output = stackexchange.run("zsh: command not found: python")
assert output != "hello"
def test_failure() -> None:
"""Test that call that doesn't run."""
stackexchange = StackExchangeAPIWrapper()
output = stackexchange.run("sjefbsmnf")
assert output == "No relevant results found for 'sjefbsmnf' on Stack Overflow"
def test_success() -> None:
"""Test that call that doesn't run."""
stackexchange = StackExchangeAPIWrapper()
output = stackexchange.run("zsh: command not found: python")
assert "zsh: command not found: python" in output