From 254c451b0be3c1d0d85a64d481234186c28b866e Mon Sep 17 00:00:00 2001 From: John Paul Date: Sun, 27 Oct 2024 22:12:14 +0530 Subject: [PATCH] Update test_aifs.py with optimizations --- tests/test_aifs.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tests/test_aifs.py b/tests/test_aifs.py index bf53230..cd23229 100644 --- a/tests/test_aifs.py +++ b/tests/test_aifs.py @@ -1,18 +1,20 @@ from aifs import search import os -def test_search_this(): +def setup_environment(): os.environ['AIFS_MINIMAL_PYTHON_INDEXING'] = 'false' - current_dir_path = os.path.dirname(os.path.realpath(__file__)) - query = "test search" - results = search(query, path=current_dir_path) + +def run_search_test(query, path): + results = search(query, path=path) print(results) assert results +def test_search_this(): + setup_environment() + current_dir_path = os.path.dirname(os.path.realpath(__file__)) + run_search_test("test search", current_dir_path) + def test_search_desktop(): - os.environ['AIFS_MINIMAL_PYTHON_INDEXING'] = 'false' + setup_environment() desktop_path = os.path.expanduser("~/Desktop") - query = "forest gump" - results = search(query, path=desktop_path) - print(results) - assert results + run_search_test("forest gump", desktop_path)