diff --git a/tests/conftest.py b/tests/conftest.py index 246f5a44..28f14ef7 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -3,8 +3,8 @@ import pytest from pathlib import Path # Internal Packages -from src.utils.config import SearchConfig, TextSearchConfig, ImageSearchConfig from src.search_type import asymmetric, image_search +from src.utils.rawconfig import SearchConfigModel, ImageSearchConfigModel, TextSearchConfigModel @pytest.fixture(scope='session') @@ -12,23 +12,21 @@ def model_dir(tmp_path_factory): model_dir = tmp_path_factory.mktemp('data') # Generate Image Embeddings from Test Images - search_config = SearchConfig() - search_config.image = ImageSearchConfig( + search_config = SearchConfigModel() + search_config.image = ImageSearchConfigModel( input_directory = Path('tests/data'), embeddings_file = model_dir.joinpath('.image_embeddings.pt'), batch_size = 10, - use_xmp_metadata = False, - verbose = 2) + use_xmp_metadata = False) image_search.setup(search_config.image, regenerate=False) # Generate Notes Embeddings from Test Notes - search_config.notes = TextSearchConfig( + search_config.org = TextSearchConfigModel( input_files = [Path('tests/data/main_readme.org'), Path('tests/data/interface_emacs_readme.org')], input_filter = None, compressed_jsonl = model_dir.joinpath('.notes.jsonl.gz'), - embeddings_file = model_dir.joinpath('.note_embeddings.pt'), - verbose = 0) + embeddings_file = model_dir.joinpath('.note_embeddings.pt')) asymmetric.setup(search_config.notes, regenerate=False) @@ -37,19 +35,17 @@ def model_dir(tmp_path_factory): @pytest.fixture(scope='session') def search_config(model_dir): - search_config = SearchConfig() - search_config.notes = TextSearchConfig( + search_config = SearchConfigModel() + search_config.org = TextSearchConfigModel( input_files = [Path('tests/data/main_readme.org'), Path('tests/data/interface_emacs_readme.org')], input_filter = None, compressed_jsonl = model_dir.joinpath('.notes.jsonl.gz'), - embeddings_file = model_dir.joinpath('.note_embeddings.pt'), - verbose = 2) + embeddings_file = model_dir.joinpath('.note_embeddings.pt')) - search_config.image = ImageSearchConfig( + search_config.image = ImageSearchConfigModel( input_directory = Path('tests/data'), embeddings_file = Path('tests/data/.image_embeddings.pt'), batch_size = 10, - use_xmp_metadata = False, - verbose = 2) + use_xmp_metadata = False) return search_config diff --git a/tests/test_asymmetric_search.py b/tests/test_asymmetric_search.py index 2d84e336..92535b28 100644 --- a/tests/test_asymmetric_search.py +++ b/tests/test_asymmetric_search.py @@ -8,7 +8,7 @@ from src.search_type import asymmetric def test_asymmetric_setup(search_config): # Act # Regenerate notes embeddings during asymmetric setup - notes_model = asymmetric.setup(search_config.notes, regenerate=True) + notes_model = asymmetric.setup(search_config.org, regenerate=True) # Assert assert len(notes_model.entries) == 10 @@ -18,7 +18,7 @@ def test_asymmetric_setup(search_config): # ---------------------------------------------------------------------------------------------------- def test_asymmetric_search(search_config): # Arrange - model.notes_search = asymmetric.setup(search_config.notes, regenerate=False) + model.notes_search = asymmetric.setup(search_config.org, regenerate=False) query = "How to git install application?" # Act