2017-03-24 08:10:14 +03:00
python3 test/test.py
Traceback (most recent call last):
2017-09-15 12:47:08 +03:00
File "test/test.py", line 17, in <module>
2020-12-23 04:20:19 +03:00
shallow(bar, 15)
2017-03-24 08:10:14 +03:00
[36m| -> 2 [m
[36m-> <function shallow at 0xDEADBEEF> [m
2017-09-15 12:47:08 +03:00
File "test/test.py", line 8, in shallow
2017-03-24 08:10:14 +03:00
deep(a + b)
[36m| | -> 15 [m
[36m| -> 2 [m
[36m-> <function deep at 0xDEADBEEF> [m
2017-09-15 12:47:08 +03:00
File "test/test.py", line 13, in deep
2020-12-23 04:20:19 +03:00
[33;1massert [m val > 10 and foo == 60
2017-03-24 08:10:14 +03:00
[36m | -> 52 [m
[36m -> 17 [m
2020-12-23 04:20:19 +03:00
AssertionError: [33;1massert [m val > 10 and foo == 60
2017-03-24 08:10:14 +03:00
python3 test/test_color.py
True
2017-04-25 01:48:26 +03:00
python3 test/test_encoding.py
Traceback (most recent call last):
2017-09-15 12:47:08 +03:00
File "test/test_encoding.py", line 14, in <module>
2017-04-25 01:48:26 +03:00
div()
[36m-> <function div at 0xDEADBEEF> [m
2017-09-15 12:47:08 +03:00
File "test/test_encoding.py", line 11, in div
2020-12-23 04:20:19 +03:00
[33;1mreturn [m _deep("天")
2017-04-25 01:48:26 +03:00
[36m -> <function _deep at 0xDEADBEEF> [m
2017-09-15 12:47:08 +03:00
File "test/test_encoding.py", line 8, in _deep
2020-12-23 04:20:19 +03:00
[33;1mreturn [m 1 / val
2017-04-25 01:48:26 +03:00
[36m -> '天' [m
TypeError: unsupported operand type(s) for /: 'int' and 'str'
2017-03-24 08:10:14 +03:00
./test/test_interactive.sh
2020-12-23 04:20:19 +03:00
spawn python -m better_exceptions -q
2017-03-24 08:10:14 +03:00
>>> import better_exceptions
>>> def foo(a):
... assert a > 10
...
>>> foo(1)
Traceback (most recent call last):
File "<console>", line 1, in <module>
2020-12-23 04:20:19 +03:00
foo(1)
2017-03-24 08:10:14 +03:00
[36m-> <function foo at 0xDEADBEEF> [m
File "<console>", line 2, in foo
2020-12-23 04:20:19 +03:00
[33;1massert [m a > 10
2017-03-24 08:10:14 +03:00
[36m -> 1 [m
2020-12-23 04:20:19 +03:00
AssertionError: [33;1massert [m a > 10
2017-03-24 08:10:14 +03:00
>>> exit()
./test/test_string.sh
2017-03-24 10:37:58 +03:00
2017-09-15 12:47:08 +03:00
import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine
2017-03-24 10:37:58 +03:00
Traceback (most recent call last):
File "<string>", line 1, in <module>
2020-12-23 04:20:19 +03:00
[33;1mimport [m better_exceptions; better_exceptions.hook(); a = 5; [33;1massert [m a > 10 [2;37m# this should work fine [m
2017-09-15 12:47:08 +03:00
[36m | | -> 5 [m
[36m | -> 5 [m
[36m -> <module 'test_module' from '/removed/for/test/purposes.py'> [m
2020-12-23 04:20:19 +03:00
AssertionError: [33;1mimport [m better_exceptions; better_exceptions.hook(); a = 5; [33;1massert [m a > 10 [2;37m# this should work fine [m
2017-03-24 10:37:58 +03:00
2017-03-24 08:10:14 +03:00
Traceback (most recent call last):
File "<string>", line 1, in <module>
2020-12-23 04:20:19 +03:00
[33;1mimport [m better_exceptions; better_exceptions.hook(); a = 5; [33;1massert [m a > 10 [2;37m# this should work fine [m
2017-09-15 12:47:08 +03:00
[36m | | -> 5 [m
[36m | -> 5 [m
[36m -> <module 'test_module' from '/removed/for/test/purposes.py'> [m
2020-12-23 04:20:19 +03:00
AssertionError: [33;1mimport [m better_exceptions; better_exceptions.hook(); a = 5; [33;1massert [m a > 10 [2;37m# this should work fine [m
2017-03-24 08:10:14 +03:00
2017-09-15 12:47:08 +03:00
from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False
2017-03-24 10:37:58 +03:00
Traceback (most recent call last):
File "<string>", line 1, in <module>
2020-12-23 04:20:19 +03:00
from __future__ import print_function; [33;1mimport [m better_exceptions; better_exceptions.hook(); a = "why hello there"; [35;1mprint [m(a); [33;1massert [m False
2017-09-15 12:47:08 +03:00
[36m | | -> 'why hello there' [m
[36m | -> 'why hello there' [m
[36m -> <module 'test_module' from '/removed/for/test/purposes.py'> [m
2020-12-23 04:20:19 +03:00
AssertionError: from __future__ import print_function; [33;1mimport [m better_exceptions; better_exceptions.hook(); a = "why hello there"; [35;1mprint [m(a); [33;1massert [m False
2017-03-24 10:37:58 +03:00
why hello there
2017-03-29 00:13:27 +03:00
2017-03-24 10:37:58 +03:00
Traceback (most recent call last):
File "<string>", line 1, in <module>
2020-12-23 04:20:19 +03:00
from __future__ import print_function; [33;1mimport [m better_exceptions; better_exceptions.hook(); a = "why hello there"; [35;1mprint [m(a); [33;1massert [m False
2017-09-15 12:47:08 +03:00
[36m | | -> 'why hello there' [m
[36m | -> 'why hello there' [m
[36m -> <module 'test_module' from '/removed/for/test/purposes.py'> [m
2020-12-23 04:20:19 +03:00
AssertionError: from __future__ import print_function; [33;1mimport [m better_exceptions; better_exceptions.hook(); a = "why hello there"; [35;1mprint [m(a); [33;1massert [m False
2017-03-29 00:13:27 +03:00
why hello there
2017-03-24 10:47:01 +03:00
2017-09-15 12:47:08 +03:00
from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False
2017-03-24 10:47:01 +03:00
Traceback (most recent call last):
File "<string>", line 1, in <module>
2020-12-23 04:20:19 +03:00
from __future__ import print_function; [33;1mimport [m better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; [35;1mprint [m(a); [33;1massert [m False
2017-09-15 12:47:08 +03:00
[36m | | -> 'why hello there' [m
[36m | -> 'why hello there' [m
[36m -> <module 'test_module' from '/removed/for/test/purposes.py'> [m
2020-12-23 04:20:19 +03:00
AssertionError: from __future__ import print_function; [33;1mimport [m better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; [35;1mprint [m(a); [33;1massert [m False
2017-03-24 10:47:01 +03:00
why hello there
2017-03-29 00:13:27 +03:00
2017-03-24 10:47:01 +03:00
Traceback (most recent call last):
File "<string>", line 1, in <module>
2020-12-23 04:20:19 +03:00
from __future__ import print_function; [33;1mimport [m better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; [35;1mprint [m(a); [33;1massert [m False
2017-09-15 12:47:08 +03:00
[36m | | -> 'why hello there' [m
[36m | -> 'why hello there' [m
[36m -> <module 'test_module' from '/removed/for/test/purposes.py'> [m
2020-12-23 04:20:19 +03:00
AssertionError: from __future__ import print_function; [33;1mimport [m better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; [35;1mprint [m(a); [33;1massert [m False
2017-03-29 00:13:27 +03:00
why hello there
python3 test/test_logging.py
ERROR:__main__:callback failed
Traceback (most recent call last):
2017-09-15 12:47:08 +03:00
File "test/test_logging.py", line 16, in foo
2017-03-29 00:13:27 +03:00
cb()
[36m-> <function bar3 at 0xDEADBEEF> [m
2017-09-15 12:47:08 +03:00
File "test/test_logging.py", line 33, in bar3
2020-12-23 04:20:19 +03:00
[33;1mraise [m [35;1mException [m('this is a test exception')
2017-03-29 00:13:27 +03:00
Exception: this is a test exception
ERROR:__main__:callback failed
Traceback (most recent call last):
2017-09-15 12:47:08 +03:00
File "test/test_logging.py", line 16, in foo
2017-03-29 00:13:27 +03:00
cb()
[36m-> <function bar4 at 0xDEADBEEF> [m
2017-09-15 12:47:08 +03:00
File "test/test_logging.py", line 38, in bar4
2020-12-23 04:20:19 +03:00
[33;1massert [m baz == 90
2017-03-29 00:13:27 +03:00
[36m -> 52 [m
2020-12-23 04:20:19 +03:00
AssertionError: [33;1massert [m baz == 90
2017-03-29 00:13:27 +03:00
2017-03-24 10:37:58 +03:00
2017-03-24 08:10:14 +03:00
2017-09-05 12:10:19 +03:00
python3 test/test_truncating.py
Traceback (most recent call last):
2017-09-15 12:47:08 +03:00
File "test/test_truncating.py", line 12, in <module>
2017-09-05 12:10:19 +03:00
div()
[36m-> <function ... [m
2017-09-15 12:47:08 +03:00
File "test/test_truncating.py", line 9, in div
2020-12-23 04:20:19 +03:00
[33;1mreturn [m 1 / var
2017-09-05 12:10:19 +03:00
[36m -> '999999999... [m
TypeError: unsupported operand type(s) for /: 'int' and 'str'
python3 test/test_truncating_disabled.py
Traceback (most recent call last):
2017-09-15 12:47:08 +03:00
File "test/test_truncating_disabled.py", line 12, in <module>
2017-09-05 12:10:19 +03:00
div()
[36m-> <function div at 0xDEADBEEF> [m
2017-09-15 12:47:08 +03:00
File "test/test_truncating_disabled.py", line 9, in div
2020-12-23 04:20:19 +03:00
[33;1mreturn [m 1 / var
2017-09-05 12:10:19 +03:00
[36m -> '999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999' [m
TypeError: unsupported operand type(s) for /: 'int' and 'str'
2017-10-19 12:53:45 +03:00
python3 test/test_indentation_error.py
Traceback (most recent call last):
File "test/test_indentation_error.py", line 13, in <module>
[35;1mexec [m(code)
[36m -> '\nif True:\n a = 5\n print("foobar") #intentional faulty indentation here.\n b = 7\n' [m
File "<string>", line 4
print("foobar") #intentional faulty indentation here.
^
IndentationError: unexpected indent
python3 test/test_syntax_error.py
Traceback (most recent call last):
File "test/test_syntax_error.py", line 12, in <module>
[35;1mexec [m(code)
[36m -> '\nif True:\n a = 5\n b = 7 *\n' [m
File "<string>", line 4
b = 7 *
^
SyntaxError: invalid syntax
2019-09-28 18:41:45 +03:00
python3 test/test_unittest_patch.py
return a + b
TypeError: unsupported operand type(s) for +: 'int' and 'str'
2020-12-23 04:20:19 +03:00
self._callTestMethod(testMethod)
[36m| -> <bound method MyTestCase.test_add of <__main__.MyTestCase testMethod=test_add>> [m
[36m-> <__main__.MyTestCase testMethod=test_add> [m
File "/removed/for/test/purposes.ext", line 633, in _callTestMethod
method()
2019-09-28 18:41:45 +03:00
[36m-> <bound method MyTestCase.test_add of <__main__.MyTestCase testMethod=test_add>> [m
File "test/test_unittest_patch.py", line 15, in test_add
2020-12-23 04:20:19 +03:00
self.assertEqual(add(1, "2"), 3)
2019-09-28 18:41:45 +03:00
[36m| -> <function add at 0xDEADBEEF> [m
[36m-> <__main__.MyTestCase testMethod=test_add> [m
File "test/test_unittest_patch.py", line 10, in add
[33;1mreturn [m a + b
[36m | -> '2' [m
[36m -> 1 [m
TypeError: unsupported operand type(s) for +: 'int' and 'str'
2019-01-09 00:09:32 +03:00
python3 test/test_chaining.py
Traceback (most recent call last):
File "test/test_chaining.py", line 11, in cause
div(x, y)
[36m| | -> 0 [m
[36m| -> 1 [m
[36m-> <function div at 0xDEADBEEF> [m
File "test/test_chaining.py", line 7, in div
x / y
[36m| -> 0 [m
[36m-> 1 [m
ZeroDivisionError: division by zero
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "test/test_chaining.py", line 17, in context
cause(x, y)
[36m| | -> 0 [m
[36m| -> 1 [m
[36m-> <function cause at 0xDEADBEEF> [m
File "test/test_chaining.py", line 13, in cause
2020-12-23 04:20:19 +03:00
[33;1mraise [m [35;1mValueError [m("Division error")
2019-01-09 00:09:32 +03:00
ValueError: Division error
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "test/test_chaining.py", line 21, in <module>
2020-12-23 04:20:19 +03:00
context(1, 0)
2019-01-09 00:09:32 +03:00
[36m-> <function context at 0xDEADBEEF> [m
File "test/test_chaining.py", line 19, in context
2020-12-23 04:20:19 +03:00
[33;1mraise [m [35;1mValueError [m("Cause error") from e
2019-01-09 00:09:32 +03:00
ValueError: Cause error