Skip to content
Open
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
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
beautifulsoup4>=4.9
requests>=2.20
pytest>=8.4.1
21 changes: 21 additions & 0 deletions tests/test_googlesearch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Introduced unit tests with pytest to make the development process a bit easier
import webbrowser
from googlesearch import *
import pytest

#sample test query
ser = "test query"

@pytest.fixture
def search_query():
return "test query"

# opening the web browser to test the library since using simple `search("google")` does not work
def test_searchactual(search_query):
search(search_query)
webbrowser.open_new_tab(next(search(search_query)))
return True

#using pytest to check if the test passes
def test_search():
assert search(ser) is not None