Skip to content

Commit

Permalink
move websearch tests back to main tests suite (#5842)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZanSara authored Sep 20, 2023
1 parent 57d33ee commit 44f0c46
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
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)

0 comments on commit 44f0c46

Please sign in to comment.