-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileHandler.py
More file actions
23 lines (19 loc) · 762 Bytes
/
Copy pathFileHandler.py
File metadata and controls
23 lines (19 loc) · 762 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
def is_java_file(file_path: str):
if file_path.endswith('.java'):
return True
else:
return False
def is_test_file(file_path: str):
result = False
if is_java_file(file_path):
if '/' in file_path:
path_split = file_path.split('/')
file_name = file_path.split('/')[-1].split('.')[0]
else:
path_split = ''
file_name = file_path.split('.')[0]
if 'test' in path_split or file_name.startswith('Test') or file_name.endswith('Test')\
or file_name.endswith('Tests') or file_name.endswith('TestCase')\
or file_name.startswith('Mock') or file_name.endswith('Mock') or 'JUnit' in file_path:
result = True
return result