pocketpy/c_bindings/test_answers.txt
2023-10-14 00:42:03 +08:00

113 lines
2.1 KiB
Plaintext

====== test basic exec ======
hello world!
====== test int methods ======
11
11
1
====== test float methods ======
11.125
11.125
====== test bool methods ======
False
0
====== test string methods ======
hello!
hello!
====== test none methods ======
None
====== test voidp methods ======
<void* at 0x7b>
123
====== test sizing and indexing ======
stack size 6
====== test error catching ======
successfully errored with this message:
File "main.py", line 1
let's make sure syntax errors get caught
SyntaxError: EOL while scanning string literal
====== test simple call ======
x : -1
====== test vararg call ======
vararg_x : 21
====== test keyword call ======
keyword_x : 4
keyword_x : 2
====== test return many ======
retmany_x : 1
retmany_x : 2
retmany_x : 3
successfully errored with this message:
TypeError: x() takes 2 positional arguments but 0 were given
['hello']
====== test bindings ======
12
====== test bindings 2 ======
2
5
4
3
2
1
====== test bindings fib ======
55
====== test error propagate ======
successfully errored with this message:
Traceback (most recent call last):
File "main.py", line 1
test_error_propagate()
NameError: catch me
====== test other errors ======
successfully errored with this message:
Traceback (most recent call last):
File "main.py", line 1
raise NameError('testing error throwing from python')
NameError: testing error throwing from python
====== test TypeError ======
successfully errored with this message:
TypeError: expected 'int', got 'float'
====== test complicated errors ======
Traceback (most recent call last):
File "main.py", line 1
test_error_propagate()
NameError: catch me
successfully errored with this message:
Traceback (most recent call last):
_: test direct error mechanism
successfully errored with this message:
Traceback (most recent call last):
File "main.py", line 1
test_nested_error()
File "main.py", line 1, in error_from_python
def error_from_python() : raise NotImplementedError()
NotImplementedError
====== test getattr/setattr ======
pi: 3.14
2
====== test eval ======
pi: 2.00
====== test py_repr ======
['1', 2, (3, '4')]