Skip to content

Commit 6cad13e

Browse files
Update test_delete_query.py
Defined `test_nested_conditions` method in `TestDirDeleteQuery` class for testing nested conditions in directory delete queries. Also defined an attribute comprising parameters for the same.
1 parent bb9212e commit 6cad13e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/test_query/test_delete_query.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,21 @@ class TestDirDeleteQuery:
196196
),
197197
]
198198

199+
nested_conditions_test_params = [
200+
(
201+
1, f"DELETE[TYPE DIR] FROM '{FILE_DIR_TEST_DIRECTORY}' WHERE parent"
202+
" LIKE '^.*file_dir[/]?$' AND (name = 'orders' OR name = 'media')"
203+
),
204+
(
205+
2, f"R DELETE[TYPE DIR] FROM '{FILE_DIR_TEST_DIRECTORY}' WHERE"
206+
" ((name IN ('src'))) AND path LIKE '^.*file_dir/src[/]?$'"
207+
),
208+
(
209+
3, f"DELETE[TYPE DIR] FROM '{FILE_DIR_TEST_DIRECTORY / 'reports'}' WHERE path LIKE "
210+
"'^.*report-20(23|24)[/]?$' AND ((name = 'report-2023') OR ((name = 'report-2024')))"
211+
),
212+
]
213+
199214
@pytest.mark.parametrize(("index", "query"), basic_query_syntax_test_params)
200215
def test_basic_query_syntax(self, index: int, query: str) -> None:
201216
"""Tests the basic directory delete query syntax."""
@@ -215,6 +230,11 @@ def test_path_types(self, index: int, query: str) -> None:
215230
def test_query_conditions(self, index: int, query: str) -> None:
216231
"""Tests directory delete query conditions."""
217232
examine_delete_query(query, f"/dir/conditions/test{index}")
233+
234+
@pytest.mark.parametrize(("index", "query"), nested_conditions_test_params)
235+
def test_nested_query_conditions(self, index: int, query: str) -> None:
236+
"""Tests nested directory delete query conditions."""
237+
examine_delete_query(query, f"/dir/nested_conditions/test{index}")
218238

219239
# The following test uses the same delete queries defined for basic query syntax test
220240
# comprising characters of mixed cases, and hence uses the file and directory records

0 commit comments

Comments
 (0)