-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_run_python_file.py
More file actions
27 lines (20 loc) · 876 Bytes
/
test_run_python_file.py
File metadata and controls
27 lines (20 loc) · 876 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
# test_run_python_file.py
from functions.run_python_file import run_python_file
print("=== Test 1: Run main.py with no args ===")
result1 = run_python_file("calculator", "main.py")
print(result1, "\n")
print("=== Test 2: Run main.py with calculator args ['3 + 5'] ===")
result2 = run_python_file("calculator", "main.py", ["3 + 5"])
print(result2, "\n")
print("=== Test 3: Run tests.py ===")
result3 = run_python_file("calculator", "tests.py")
print(result3, "\n")
print("=== Test 4: Run file outside working directory ('../main.py') ===")
result4 = run_python_file("calculator", "../main.py")
print(result4, "\n")
print("=== Test 5: Run nonexistent.py ===")
result5 = run_python_file("calculator", "nonexistent.py")
print(result5, "\n")
print("=== Test 6: Run a non-Python file (lorem.txt) ===")
result6 = run_python_file("calculator", "lorem.txt")
print(result6, "\n")