-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_run_python_file.py
More file actions
30 lines (22 loc) · 874 Bytes
/
test_run_python_file.py
File metadata and controls
30 lines (22 loc) · 874 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
from functions.run_python_file import run_python_file
def test():
# Test 1: Run a simple Python file without arguments
result = run_python_file("calculator", "main.py")
print(result)
# Test 2: Run a python file with arguments
result = run_python_file("calculator", "main.py", ["3 + 5"])
print(result)
# Test 3: Attemp to run calculator with tests.py
result = run_python_file("calculator", "tests.py")
print(result)
# Test 4: Attempt to run form a different directory
result = run_python_file("calculator", "../main.py")
print(result)
# Test 5: Attempt to run a non-xistent file
result = run_python_file("calculator", "nonexistent.py")
print(result)
# Test 6: Attempt ti run a text file
result = run_python_file("calculator", "lorem.txt")
print(result)
if __name__ == "__main__":
test()