Skip to content

Commit

Permalink
chore:Update import paths in search test module
Browse files Browse the repository at this point in the history
Modify import paths for `create_search_query` and `SearchQuery` in `test_search.py` to reflect the correct module structure under `app/search/utils/search.py`. This ensures that test cases reference the correct location and maintain consistency with the application structure.
  • Loading branch information
hareshkainthdbt committed Dec 10, 2024
1 parent 36aae1f commit a981486
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions app/search/tests/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

from unittest.mock import MagicMock, call, patch

from search.utils.search import create_search_query
from app.search.utils.search import create_search_query


class TestCreateSearchQuery(unittest.TestCase):

@patch("search.utils.search.SearchQuery", autospec=True)
@patch("app.search.utils.search.SearchQuery", autospec=True)
def test_single_word_query(self, mock_search_query):
result = create_search_query("test")
mock_search_query.assert_called_with("test", search_type="plain")
self.assertEqual(result, mock_search_query.return_value)

@patch("search.utils.search.SearchQuery", autospec=True)
@patch("app.search.utils.search.SearchQuery", autospec=True)
def test_implicit_and_search_operator_query(self, mock_search_query):
# Mock SearchQuery instances
mock_query1 = MagicMock(name="MockQuery1")
Expand All @@ -35,7 +35,7 @@ def test_implicit_and_search_operator_query(self, mock_search_query):
# Assert the AND operation was applied
mock_query1.__and__.assert_called_once_with(mock_query2)

@patch("search.utils.search.SearchQuery", autospec=True)
@patch("app.search.utils.search.SearchQuery", autospec=True)
def test_multiple_implicit_and_search_operator_query(
self, mock_search_query
):
Expand All @@ -61,7 +61,7 @@ def test_multiple_implicit_and_search_operator_query(
# Assert the AND operation was applied
mock_query1.__and__.assert_called_with(mock_query3)

@patch("search.utils.search.SearchQuery", autospec=True)
@patch("app.search.utils.search.SearchQuery", autospec=True)
def test_and_search_operator_query(self, mock_search_query):
# Mock SearchQuery instances
mock_query1 = MagicMock(name="MockQuery1")
Expand All @@ -83,7 +83,7 @@ def test_and_search_operator_query(self, mock_search_query):
# Assert the AND operation was applied
mock_query1.__and__.assert_called_once_with(mock_query2)

@patch("search.utils.search.SearchQuery", autospec=True)
@patch("app.search.utils.search.SearchQuery", autospec=True)
def test_multiple_and_search_operator_query(self, mock_search_query):
# Mock SearchQuery instances
mock_query1 = MagicMock(name="MockQuery1")
Expand All @@ -107,7 +107,7 @@ def test_multiple_and_search_operator_query(self, mock_search_query):
# Assert the AND operation was applied
mock_query1.__and__.assert_called_with(mock_query3)

@patch("search.utils.search.SearchQuery", autospec=True)
@patch("app.search.utils.search.SearchQuery", autospec=True)
def test_or_search_operator_query(self, mock_search_query):
# Mock SearchQuery instances
mock_query1 = MagicMock(name="MockQuery1")
Expand All @@ -129,7 +129,7 @@ def test_or_search_operator_query(self, mock_search_query):
# Assert the AND operation was applied
mock_query1.__or__.assert_called_once_with(mock_query2)

@patch("search.utils.search.SearchQuery", autospec=True)
@patch("app.search.utils.search.SearchQuery", autospec=True)
def test_multple_or_search_operator_query(self, mock_search_query):
# Mock SearchQuery instances
mock_query1 = MagicMock(name="MockQuery1")
Expand All @@ -153,7 +153,7 @@ def test_multple_or_search_operator_query(self, mock_search_query):
# Assert the AND operation was applied
mock_query1.__or__.assert_called_with(mock_query3)

@patch("search.utils.search.SearchQuery", autospec=True)
@patch("app.search.utils.search.SearchQuery", autospec=True)
def test_multiple_or_search_operator_query(self, mock_search_query):
# Mock SearchQuery instances
mock_query1 = MagicMock(name="MockQuery1")
Expand All @@ -177,15 +177,15 @@ def test_multiple_or_search_operator_query(self, mock_search_query):
# Assert the AND operation was applied
mock_query1.__or__.assert_called_with(mock_query3)

@patch("search.utils.search.SearchQuery", autospec=True)
@patch("app.search.utils.search.SearchQuery", autospec=True)
def test_phrase_search_query(self, mock_search_query):
result = create_search_query('"test trial"')
mock_search_query.assert_called_with(
"test trial", search_type="phrase"
)
self.assertEqual(result, mock_search_query.return_value)

@patch("search.utils.search.SearchQuery", autospec=True)
@patch("app.search.utils.search.SearchQuery", autospec=True)
def test_and_multiple_single_single_phrase_search_query(
self, mock_search_query
):
Expand Down Expand Up @@ -221,7 +221,7 @@ def test_and_multiple_single_single_phrase_search_query(
# Assert the AND operation was applied
mock_query1.__and__.assert_called_with(mock_query5)

@patch("search.utils.search.SearchQuery", autospec=True)
@patch("app.search.utils.search.SearchQuery", autospec=True)
def test_single_or_and_search_operator_query(self, mock_search_query):
# Mock SearchQuery instances
mock_query1 = MagicMock(name="MockQuery1")
Expand Down

0 comments on commit a981486

Please sign in to comment.