langchain/libs/community/tests/integration_tests/utilities/test_stackexchange.py
Eugene Yurtsev 25fbe356b4
community[patch]: upgrade to recent version of mypy (#21616)
This PR upgrades community to a recent version of mypy. It inserts type:
ignore on all existing failures.
2024-05-13 14:55:07 -04:00

24 lines
869 B
Python

"""Integration test for Stack Exchange."""
from langchain_community.utilities import StackExchangeAPIWrapper
def test_call() -> None:
"""Test that call runs."""
stackexchange = StackExchangeAPIWrapper() # type: ignore[call-arg]
output = stackexchange.run("zsh: command not found: python")
assert output != "hello"
def test_failure() -> None:
"""Test that call that doesn't run."""
stackexchange = StackExchangeAPIWrapper() # type: ignore[call-arg]
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() # type: ignore[call-arg]
output = stackexchange.run("zsh: command not found: python")
assert "zsh: command not found: python" in output