-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests.py
More file actions
64 lines (46 loc) · 1.83 KB
/
tests.py
File metadata and controls
64 lines (46 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
from functions.run_python import run_python_file
from functions.get_files_info import get_files_info
from functions.get_file_content import get_file_content
from functions.write_file_content import write_file
def test():
# result = get_files_info("calculator", ".")
# print("Result for current directory:")
# print(result)
# print("")
# result = get_files_info("calculator", "pkg")
# print("Result for 'pkg' directory:")
# print(result)
# result = get_files_info("calculator", "/bin")
# print("Result for '/bin' directory:")
# print(result)
# result = get_files_info("calculator", "../")
# print("Result for '../' directory:")
# print(result)
# result = get_file_content("calculator", "lorem.txt")
# print(result)
# result = get_file_content("calculator", "main.py")
# print(result)
# result = get_file_content("calculator", "pkg/calculator.py")
# print(result)
# result = get_file_content("calculator", "/bin/cat")
# print(result)
# result = get_file_content("calculator", "pkg/does_not_exist.py")
# print(result)
# result = write_file("calculator", "lorem.txt", "wait, this isn't lorem ipsum")
# print(result)
# result = write_file("calculator", "pkg/morelorem.txt", "lorem ipsum dolor sit amet")
# print(result)
# result = write_file("calculator", "/tmp/temp.txt", "this should not be allowed")
# print(result)
result = run_python_file("calculator", "main.py")
print(result)
result = run_python_file("calculator", "main.py", ["3 + 5"])
print(result)
result = run_python_file("calculator", "../main.py")
print(result)
result = run_python_file("calculator", "nonexistent.py")
print(result)
result = run_python_file("calculator", "lorem.txt")
print(result)
if __name__ == "__main__":
test()