test_answers.txt 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. ====== test basic exec ======
  2. hello world!
  3. ====== test int methods ======
  4. 11
  5. 11
  6. 1
  7. ====== test float methods ======
  8. 11.125
  9. 11.125
  10. ====== test bool methods ======
  11. False
  12. 0
  13. ====== test string methods ======
  14. hello!
  15. hello!
  16. ====== test none methods ======
  17. None
  18. ====== test voidp methods ======
  19. <void* at 0x7b>
  20. 123
  21. ====== test sizing and indexing ======
  22. stack size 6
  23. ====== test error catching ======
  24. successfully errored with this message:
  25. File "main.py", line 1
  26. let's make sure syntax errors get caught
  27. SyntaxError: EOL while scanning string literal
  28. ====== test simple call ======
  29. x : -1
  30. ====== test vararg call ======
  31. vararg_x : 21
  32. ====== test keyword call ======
  33. keyword_x : 4
  34. keyword_x : 2
  35. ====== test return many ======
  36. retmany_x : 1
  37. retmany_x : 2
  38. retmany_x : 3
  39. successfully errored with this message:
  40. TypeError: x() takes 2 positional arguments but 0 were given
  41. ['hello']
  42. ====== test bindings ======
  43. 12
  44. ====== test bindings 2 ======
  45. 2
  46. 5
  47. 4
  48. 3
  49. 2
  50. 1
  51. ====== test bindings fib ======
  52. 55
  53. ====== test error propagate ======
  54. successfully errored with this message:
  55. Traceback (most recent call last):
  56. File "main.py", line 1
  57. test_error_propagate()
  58. NameError: catch me
  59. ====== test other errors ======
  60. successfully errored with this message:
  61. Traceback (most recent call last):
  62. File "main.py", line 1
  63. raise NameError('testing error throwing from python')
  64. NameError: testing error throwing from python
  65. ====== test TypeError ======
  66. successfully errored with this message:
  67. TypeError: expected 'int', got 'float'
  68. ====== test complicated errors ======
  69. Traceback (most recent call last):
  70. File "main.py", line 1
  71. test_error_propagate()
  72. NameError: catch me
  73. successfully errored with this message:
  74. Traceback (most recent call last):
  75. Exception: test direct error mechanism
  76. successfully errored with this message:
  77. Traceback (most recent call last):
  78. File "main.py", line 1
  79. test_nested_error()
  80. File "main.py", line 1, in error_from_python
  81. def error_from_python() : raise NotImplementedError()
  82. NotImplementedError
  83. ====== test getattr/setattr ======
  84. pi: 3.14
  85. 2
  86. ====== test eval ======
  87. pi: 2.00
  88. ====== test py_repr ======
  89. ['1', 2, (3, '4')]