Skip to content

Commit 2d1a428

Browse files
committed
Add test case for non-exist file extension pattern handling
1 parent 6d37e15 commit 2d1a428

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

tests/test_query_ingestion.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,22 @@ def test_include_txt_pattern(temp_directory: Path, sample_query: dict[str, Any])
7777
assert not any(path.endswith(".py") for path in file_paths), "Should not include .py files"
7878

7979

80-
# TODO: test with wrong include patterns: ['*.qwerty']
80+
def test_include_nonexistent_extension(temp_directory: Path, sample_query: dict[str, Any]) -> None:
81+
sample_query["local_path"] = temp_directory
82+
sample_query["include_patterns"] = ["*.query"] # Is a Non existant extension ?
83+
84+
result = _scan_directory(temp_directory, query=sample_query)
85+
assert result is not None, "Result should not be None"
86+
87+
# Extract the files content & set file limit cap
88+
files = _extract_files_content(query=sample_query, node=result, max_file_size=1_000_000)
89+
# Verify no file processed with wrong extension
90+
assert len(files) == 0, "Should not find any files with .qwerty extension"
91+
92+
assert result["type"] == "directory"
93+
assert result["file_count"] == 0
94+
assert result["dir_count"] == 0
95+
assert len(result["children"]) == 0
8196

8297

8398
# single folder patterns

0 commit comments

Comments
 (0)