From c823f46d890ffd92b953184ea93d54f795b72dc1 Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Thu, 2 Mar 2023 15:35:39 -0600 Subject: [PATCH] Test error on missing fields in ContentConfig pulled from Khoj.yml Resolves #9 --- tests/test_rawconfig.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tests/test_rawconfig.py diff --git a/tests/test_rawconfig.py b/tests/test_rawconfig.py new file mode 100644 index 00000000..50baa92a --- /dev/null +++ b/tests/test_rawconfig.py @@ -0,0 +1,29 @@ +# External Packages +import pytest + +# Internal Packages +from khoj.utils.rawconfig import TextContentConfig, ImageContentConfig + + +# Test +# ---------------------------------------------------------------------------------------------------- +def test_input_file_or_filter_required_in_text_content_config(): + # Act + with pytest.raises(ValueError): + TextContentConfig( + input_files=None, + input_filter=None, + compressed_jsonl="notes.jsonl", + embeddings_file="note_embeddings.pt", + ) + + +# ---------------------------------------------------------------------------------------------------- +def test_input_filter_or_directories_required_in_image_content_config(): + # Act + with pytest.raises(ValueError): + ImageContentConfig( + input_directories=None, + input_filter=None, + embeddings_file="note_embeddings.pt", + )