From 729430ca1f9746e610a634c35acd2d2ba5a8a7e0 Mon Sep 17 00:00:00 2001 From: deedy5 <65482418+deedy5@users.noreply.github.com> Date: Fri, 15 Nov 2024 01:03:36 +0300 Subject: [PATCH] update tests --- tests/test_cli.py | 10 +++++----- tests/test_duckduckgo_search.py | 8 ++++---- tests/test_duckduckgo_search_async.py | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/test_cli.py b/tests/test_cli.py index a50fa53..15bd2ea 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -13,7 +13,7 @@ @pytest.fixture(autouse=True) def pause_between_tests(): - time.sleep(0.5) + time.sleep(1) def test_version_command(): @@ -70,7 +70,7 @@ def test_save_csv(tmp_path): keywords = "butterfly" with DDGS() as ddgs: results = ddgs.text(keywords, max_results=30) - assert 27 <= len(results) <= 30 + assert 25 <= len(results) <= 30 temp_file = tmp_path / f"{keywords}.csv" _save_csv(temp_file, results) @@ -81,7 +81,7 @@ def test_save_json(tmp_path): keywords = "chicago" with DDGS() as ddgs: results = ddgs.text(keywords, max_results=30) - assert 27 <= len(results) <= 30 + assert 25 <= len(results) <= 30 temp_file = tmp_path / f"{keywords}.json" _save_json(temp_file, results) @@ -94,7 +94,7 @@ def test_text_download(): results = ddgs.text(keywords, max_results=8) assert 7 <= len(results) <= 8 - _download_results(keywords, results) + _download_results(keywords, results, function_name="text") # delete files contains keyword in name files = False @@ -121,7 +121,7 @@ def test_images_download(): results = ddgs.images(keywords, max_results=8) assert len(results) >= 8 - _download_results(keywords, results, images=True) + _download_results(keywords, results, function_name="images") # delete files contains keyword in name files = False diff --git a/tests/test_duckduckgo_search.py b/tests/test_duckduckgo_search.py index 754be36..084e7aa 100644 --- a/tests/test_duckduckgo_search.py +++ b/tests/test_duckduckgo_search.py @@ -6,7 +6,7 @@ @pytest.fixture(autouse=True) def pause_between_tests(): - time.sleep(0.5) + time.sleep(1) def test_context_manager(): @@ -23,17 +23,17 @@ def test_chat(model): def test_text(): results = DDGS().text("cat", safesearch="off", timelimit="m", max_results=30) - assert 27 <= len(results) <= 30 + assert 25 <= len(results) <= 30 def test_text_html(): results = DDGS().text("eagle", backend="html", max_results=30) - assert 27 <= len(results) <= 30 + assert 25 <= len(results) <= 30 def test_text_lite(): results = DDGS().text("dog", backend="lite", max_results=30) - assert 27 <= len(results) <= 30 + assert 25 <= len(results) <= 30 def test_images(): diff --git a/tests/test_duckduckgo_search_async.py b/tests/test_duckduckgo_search_async.py index 32c0928..de4f832 100644 --- a/tests/test_duckduckgo_search_async.py +++ b/tests/test_duckduckgo_search_async.py @@ -6,7 +6,7 @@ @pytest.fixture(autouse=True) def pause_between_tests(): - time.sleep(0.5) + time.sleep(1) @pytest.mark.asyncio async def test_context_manager(): @@ -25,19 +25,19 @@ async def test_chat(model): @pytest.mark.asyncio async def test_text(): results = await AsyncDDGS().atext("sky", safesearch="off", timelimit="m", max_results=30) - assert 27 <= len(results) <= 30 + assert 25 <= len(results) <= 30 @pytest.mark.asyncio async def test_text_html(): results = await AsyncDDGS().atext("eagle", backend="html", max_results=30) - assert 27 <= len(results) <= 30 + assert 25 <= len(results) <= 30 @pytest.mark.asyncio async def test_text_lite(): results = await AsyncDDGS().atext("dog", backend="lite", max_results=30) - assert 27 <= len(results) <= 30 + assert 25 <= len(results) <= 30 @pytest.mark.asyncio