11
11
from fise .common import constants
12
12
from fise .query import QueryHandler
13
13
14
- TEST_DIRECTORY = Path (__file__ ).parents [1 ] / "test_directory"
14
+ FILE_DIR_TEST_DIRECTORY = Path (__file__ ).parents [1 ] / "test_directory/file_dir "
15
15
16
16
17
17
class TestFileSearchQuery :
18
18
"""Tests the file search queries."""
19
19
20
20
basic_query_syntax_test_params = [
21
- f"R SELECT * FROM '{ TEST_DIRECTORY / 'file_dir' } '" ,
22
- f"SELECT[TYPE FILE] name, filetype FROM '{ TEST_DIRECTORY / 'file_dir' } '" ,
23
- f"RECURSIVE SELECT * FROM '{ TEST_DIRECTORY } ' WHERE filetype = '.py'" ,
21
+ f"R SELECT * FROM '{ FILE_DIR_TEST_DIRECTORY } '" ,
22
+ f"SELECT[TYPE FILE] name, filetype FROM '{ FILE_DIR_TEST_DIRECTORY } '" ,
23
+ f"RECURSIVE SELECT * FROM '{ FILE_DIR_TEST_DIRECTORY } ' WHERE filetype = '.py'" ,
24
24
]
25
25
26
26
mixed_case_query_test_params = [
27
- f"r Select * FroM '{ TEST_DIRECTORY / 'file_dir' } '" ,
28
- f"sELect[TYPE FILE] Name, FileType From '{ TEST_DIRECTORY / 'file_dir' } '" ,
29
- f"RecURSive sELECt * From '{ TEST_DIRECTORY } ' wHErE FilETypE = '.py'" ,
27
+ f"r Select * FroM '{ FILE_DIR_TEST_DIRECTORY } '" ,
28
+ f"sELect[TYPE FILE] Name, FileType From '{ FILE_DIR_TEST_DIRECTORY } '" ,
29
+ f"RecURSive sELECt * From '{ FILE_DIR_TEST_DIRECTORY } ' wHErE FilETypE = '.py'" ,
30
30
]
31
31
32
32
individual_fields_test_params = constants .FILE_FIELDS + ("*" ,)
@@ -45,7 +45,7 @@ def test_basic_query_syntax(self, query: str) -> None:
45
45
def test_individual_fields (self , field : str ) -> None :
46
46
"""Tests file search queries with all file fields individually."""
47
47
48
- query : str = f"SELECT { field } FROM '{ TEST_DIRECTORY } '"
48
+ query : str = f"SELECT { field } FROM '{ FILE_DIR_TEST_DIRECTORY } '"
49
49
50
50
data : pd .DataFrame = QueryHandler (query ).handle ()
51
51
assert isinstance (data , pd .DataFrame )
@@ -66,15 +66,15 @@ class TestDirSearchQuery:
66
66
"""Tests the directory search queries."""
67
67
68
68
basic_query_syntax_test_params = [
69
- f"R SELECT[TYPE DIR] * FROM '{ TEST_DIRECTORY / 'file_dir' } '" ,
70
- f"SELECT[TYPE DIR] name, parent, ctime FROM '{ TEST_DIRECTORY / 'file_dir' } '" ,
71
- f"RECURSIVE SELECT[TYPE DIR] * FROM '{ TEST_DIRECTORY } ' WHERE name IN ('orders', 'reports')" ,
69
+ f"R SELECT[TYPE DIR] * FROM '{ FILE_DIR_TEST_DIRECTORY } '" ,
70
+ f"RECURSIVE SELECT[TYPE DIR] name, parent, ctime FROM '{ FILE_DIR_TEST_DIRECTORY } '" ,
71
+ f"SELECT[TYPE DIR] * FROM '{ FILE_DIR_TEST_DIRECTORY } ' WHERE name IN ('orders', 'reports')" ,
72
72
]
73
73
74
74
mixed_case_query_test_params = [
75
- f"r SELECT[Type DiR] * fROm '{ TEST_DIRECTORY / 'file_dir' } '" ,
76
- f"sEleCt[typE dIr] name, parent, ctime FroM '{ TEST_DIRECTORY / 'file_dir' } '" ,
77
- f"Recursive Select[TYPE DIR] * From '{ TEST_DIRECTORY } ' Where name In ('orders', 'reports')" ,
75
+ f"r SELECT[Type DiR] * fROm '{ FILE_DIR_TEST_DIRECTORY } '" ,
76
+ f"Recursive sEleCt[typE dIr] name, parent, ctime FroM '{ FILE_DIR_TEST_DIRECTORY } '" ,
77
+ f"Select[TYPE DIR] * From '{ FILE_DIR_TEST_DIRECTORY } ' Where name In ('orders', 'reports')" ,
78
78
]
79
79
80
80
individual_fields_test_params = constants .DIR_FIELDS + ("*" ,)
@@ -93,7 +93,7 @@ def test_basic_query_syntax(self, query: str) -> None:
93
93
def test_individual_fields (self , field : str ) -> None :
94
94
"""Tests individual fields in directory search queries."""
95
95
96
- query : str = f"SELECT[TYPE DIR] { field } FROM '{ TEST_DIRECTORY } '"
96
+ query : str = f"SELECT[TYPE DIR] { field } FROM '{ FILE_DIR_TEST_DIRECTORY } '"
97
97
98
98
data : pd .DataFrame = QueryHandler (query ).handle ()
99
99
assert isinstance (data , pd .DataFrame )
0 commit comments