-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_run_python_file.py
More file actions
34 lines (25 loc) · 867 Bytes
/
Copy pathtest_run_python_file.py
File metadata and controls
34 lines (25 loc) · 867 Bytes
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
from functions.run_python_file import run_python_file
def print_result(title, result):
print(title)
print(result)
print("-" * 60)
if __name__ == "__main__":
print_result(
"Running calculator main.py (no args):",
run_python_file("calculator", "main.py"),
)
print_result(
"Running calculator main.py with args:",
run_python_file("calculator", "main.py", ["3 + 5"]),
)
print_result(
"Running calculator tests.py:", run_python_file("calculator", "tests.py")
)
print_result(
"Attempting to escape working directory:",
run_python_file("calculator", "../main.py"),
)
print_result(
"Running nonexistent file:", run_python_file("calculator", "nonexistent.py")
)
print_result("Running non-Python file:", run_python_file("calculator", "lorem.txt"))