-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_run_python_file.py
More file actions
36 lines (27 loc) · 1.06 KB
/
Copy pathtest_run_python_file.py
File metadata and controls
36 lines (27 loc) · 1.06 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
from functions.run_python_file import run_python_file
def main():
print("Test 1: run_python_file('calculator', 'main.py')")
result = run_python_file("calculator", "main.py")
print(result)
print()
print("Test 2: run_python_file('calculator', 'main.py', ['3 + 5'])")
result = run_python_file("calculator", "main.py", ["3 + 5"])
print(result)
print()
print("Test 3: run_python_file('calculator', 'tests.py')")
result = run_python_file("calculator", "tests.py")
print(result)
print()
print("Test 4: run_python_file('calculator', '../main.py') - outside working directory")
result = run_python_file("calculator", "../main.py")
print(result)
print()
print("Test 5: run_python_file('calculator', 'nonexistent.py') - file not found")
result = run_python_file("calculator", "nonexistent.py")
print(result)
print()
print("Test 6: run_python_file('calculator', 'lorem.txt') - not a Python file")
result = run_python_file("calculator", "lorem.txt")
print(result)
if __name__ == "__main__":
main()