96 lines
1.9 KiB
YAML
96 lines
1.9 KiB
YAML
tests:
|
|
- name: "Simple print statement"
|
|
stdin: |
|
|
print("Hello, World!")
|
|
stdout: |
|
|
Hello, World!
|
|
exit: success
|
|
|
|
- name: "Basic arithmetic"
|
|
stdin: |
|
|
print(2 + 2)
|
|
print(10 * 5)
|
|
stdout: |
|
|
4
|
|
50
|
|
exit: success
|
|
|
|
- name: "Variable assignment and usage"
|
|
stdin: |
|
|
x = 42
|
|
y = 8
|
|
print(x + y)
|
|
stdout: |
|
|
50
|
|
exit: success
|
|
|
|
- name: "Syntax error detection"
|
|
stdin: |
|
|
print("missing closing quote)
|
|
stderr: |
|
|
SyntaxError: unterminated string literal (detected at line 1)
|
|
exit: error
|
|
error_code: 1
|
|
|
|
- name: "Import and use module"
|
|
stdin: |
|
|
import math
|
|
print(math.pi)
|
|
stdout: |
|
|
3.141592653589793
|
|
exit: success
|
|
|
|
- name: "List operations"
|
|
stdin: |
|
|
numbers = [1, 2, 3, 4, 5]
|
|
print(sum(numbers))
|
|
print(len(numbers))
|
|
stdout: |
|
|
15
|
|
5
|
|
exit: success
|
|
|
|
- name: "Execute Python file with args"
|
|
args: ["-c", "import sys; print(f'Args: {sys.argv[1:]}'); print('Done')", "arg1", "arg2"]
|
|
stdout: |
|
|
Args: ['arg1', 'arg2']
|
|
Done
|
|
exit: success
|
|
|
|
- name: "Division by zero error"
|
|
stdin: |
|
|
print(1 / 0)
|
|
stderr: |
|
|
Traceback (most recent call last):
|
|
File "<stdin>", line 1, in <module>
|
|
ZeroDivisionError: division by zero
|
|
exit: error
|
|
|
|
- name: "Check Python version (using args instead of stdin)"
|
|
args: ["--version"]
|
|
stdout: "Python 3"
|
|
exit: success
|
|
timeout: 2.0
|
|
|
|
- name: "Multi-line function definition"
|
|
stdin: |
|
|
def greet(name):
|
|
return f"Hello, {name}!"
|
|
|
|
print(greet("Alice"))
|
|
print(greet("Bob"))
|
|
stdout: |
|
|
Hello, Alice!
|
|
Hello, Bob!
|
|
exit: success
|
|
|
|
- name: "Long running operation with custom timeout"
|
|
stdin: |
|
|
import time
|
|
time.sleep(0.5)
|
|
print("Done sleeping")
|
|
stdout: |
|
|
Done sleeping
|
|
exit: success
|
|
timeout: 2.0
|