Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: move websearch tests back to main tests suite #5842

Merged
merged 1 commit into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions e2e/preview/components/test_serperdev_websearch.py

This file was deleted.

12 changes: 12 additions & 0 deletions test/preview/components/websearch/test_serperdev.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from unittest.mock import Mock, patch

import pytest
Expand Down Expand Up @@ -176,3 +177,14 @@ def test_bad_response_code(self, mock_post):

with pytest.raises(SerperDevError):
ws.run(query="Who is the boyfriend of Olivia Wilde?")

@pytest.mark.skipif(
not os.environ.get("SERPERDEV_API_KEY", None),
reason="Export an env var called SERPERDEV_API_KEY containing the SerperDev API key to run this test.",
)
@pytest.mark.integration
def test_web_search():
ws = SerperDevWebSearch(api_key=os.environ.get("SERPERDEV_API_KEY", None), top_k=10)
results = ws.run(query="Who is the boyfriend of Olivia Wilde?")["documents"]
assert len(results) == 10
assert all(isinstance(doc, Document) for doc in results)