From 0bfc094e188cbab3dbc914a0a8f0855207fdc35b Mon Sep 17 00:00:00 2001 From: Asim Shrestha <50181239+asim-shrestha@users.noreply.github.com> Date: Sat, 11 Nov 2023 17:08:58 -0800 Subject: [PATCH 1/2] Add test separators --- tests/test_word_filter.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/test_word_filter.py b/tests/test_word_filter.py index 04f45506..4d29af05 100644 --- a/tests/test_word_filter.py +++ b/tests/test_word_filter.py @@ -2,7 +2,8 @@ from khoj.search_filter.word_filter import WordFilter from khoj.utils.rawconfig import Entry - +# Test +# ---------------------------------------------------------------------------------------------------- def test_no_word_filter(): # Arrange word_filter = WordFilter() @@ -19,6 +20,7 @@ def test_no_word_filter(): assert entry_indices == {0, 1, 2, 3} +# ---------------------------------------------------------------------------------------------------- def test_word_exclude_filter(): # Arrange word_filter = WordFilter() @@ -35,6 +37,7 @@ def test_word_exclude_filter(): assert entry_indices == {0, 2} +# ---------------------------------------------------------------------------------------------------- def test_word_include_filter(): # Arrange word_filter = WordFilter() @@ -51,6 +54,7 @@ def test_word_include_filter(): assert entry_indices == {2, 3} +# ---------------------------------------------------------------------------------------------------- def test_word_include_and_exclude_filter(): # Arrange word_filter = WordFilter() @@ -67,6 +71,7 @@ def test_word_include_and_exclude_filter(): assert entry_indices == {2} +# ---------------------------------------------------------------------------------------------------- def test_get_word_filter_terms(): # Arrange word_filter = WordFilter() From e398a76779311bf111edc83625d80932df4ab38a Mon Sep 17 00:00:00 2001 From: sabaimran Date: Sun, 19 Nov 2023 13:14:58 -0800 Subject: [PATCH 2/2] Fix test word filter --- tests/test_word_filter.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/test_word_filter.py b/tests/test_word_filter.py index 253caedd..ebd6cccf 100644 --- a/tests/test_word_filter.py +++ b/tests/test_word_filter.py @@ -8,17 +8,15 @@ from khoj.utils.rawconfig import Entry def test_no_word_filter(): # Arrange word_filter = WordFilter() - entries = arrange_content() q_with_no_filter = "head tail" # Act can_filter = word_filter.can_filter(q_with_no_filter) - ret_query, entry_indices = word_filter.apply(q_with_no_filter, entries) + filter_terms = word_filter.get_filter_terms(q_with_no_filter) # Assert assert can_filter == False - assert ret_query == "head tail" - assert entry_indices == {0, 1, 2, 3} + assert filter_terms == [] # ----------------------------------------------------------------------------------------------------