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>
2017-03-24 08:10:14 +03:00
shallow(bar, [31m15 [m)
[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
2017-03-24 08:10:14 +03:00
[33;1massert [m val > [31m10 [m and foo == [31m60 [m
[36m | -> 52 [m
[36m -> 17 [m
AssertionError: [33;1massert [m val > [31m10 [m and foo == [31m60 [m
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
2017-04-25 01:48:26 +03:00
[33;1mreturn [m _deep( [31m'天' [m)
[36m -> <function _deep at 0xDEADBEEF> [m
2017-09-15 12:47:08 +03:00
File "test/test_encoding.py", line 8, in _deep
2017-04-25 01:48:26 +03:00
[33;1mreturn [m [31m1 [m / val
[36m -> '天' [m
TypeError: unsupported operand type(s) for /: 'int' and 'str'
2017-03-24 08:10:14 +03:00
./test/test_interactive.sh
spawn python3 -m better_exceptions -q
>>> import better_exceptions
>>> def foo(a):
... assert a > 10
...
>>> foo(1)
Traceback (most recent call last):
File "<console>", line 1, in <module>
foo( [31m1 [m)
[36m-> <function foo at 0xDEADBEEF> [m
File "<console>", line 2, in foo
[33;1massert [m a > [31m10 [m
[36m -> 1 [m
AssertionError: [33;1massert [m a > [31m10 [m
>>> 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>
2017-09-15 12:47:08 +03:00
[33;1mimport [m better_exceptions; better_exceptions.hook(); a = [31m5 [m; [33;1massert [m a > [31m10 [m [2;37m# this should work fine [m
[36m | | -> 5 [m
[36m | -> 5 [m
[36m -> <module 'test_module' from '/removed/for/test/purposes.py'> [m
AssertionError: [33;1mimport [m better_exceptions; better_exceptions.hook(); a = [31m5 [m; [33;1massert [m a > [31m10 [m [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>
2017-09-15 12:47:08 +03:00
[33;1mimport [m better_exceptions; better_exceptions.hook(); a = [31m5 [m; [33;1massert [m a > [31m10 [m [2;37m# this should work fine [m
[36m | | -> 5 [m
[36m | -> 5 [m
[36m -> <module 'test_module' from '/removed/for/test/purposes.py'> [m
AssertionError: [33;1mimport [m better_exceptions; better_exceptions.hook(); a = [31m5 [m; [33;1massert [m a > [31m10 [m [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>
2017-09-15 12:47:08 +03:00
from __future__ import print_function; [33;1mimport [m better_exceptions; better_exceptions.hook(); a = [31m'why hello there' [m; [35;1mprint [m(a); [33;1massert [m False
[36m | | -> 'why hello there' [m
[36m | -> 'why hello there' [m
[36m -> <module 'test_module' from '/removed/for/test/purposes.py'> [m
AssertionError: from __future__ import print_function; [33;1mimport [m better_exceptions; better_exceptions.hook(); a = [31m'why hello there' [m; [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>
2017-09-15 12:47:08 +03:00
from __future__ import print_function; [33;1mimport [m better_exceptions; better_exceptions.hook(); a = [31m'why hello there' [m; [35;1mprint [m(a); [33;1massert [m False
[36m | | -> 'why hello there' [m
[36m | -> 'why hello there' [m
[36m -> <module 'test_module' from '/removed/for/test/purposes.py'> [m
AssertionError: from __future__ import print_function; [33;1mimport [m better_exceptions; better_exceptions.hook(); a = [31m'why hello there' [m; [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>
2017-09-15 12:47:08 +03:00
from __future__ import print_function; [33;1mimport [m better_exceptions; better_exceptions.hook(); a = [31m'why hello ' [m + [31m' there' [m; [35;1mprint [m(a); [33;1massert [m False
[36m | | -> 'why hello there' [m
[36m | -> 'why hello there' [m
[36m -> <module 'test_module' from '/removed/for/test/purposes.py'> [m
AssertionError: from __future__ import print_function; [33;1mimport [m better_exceptions; better_exceptions.hook(); a = [31m'why hello ' [m + [31m' there' [m; [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>
2017-09-15 12:47:08 +03:00
from __future__ import print_function; [33;1mimport [m better_exceptions; better_exceptions.hook(); a = [31m'why hello ' [m + [31m' there' [m; [35;1mprint [m(a); [33;1massert [m False
[36m | | -> 'why hello there' [m
[36m | -> 'why hello there' [m
[36m -> <module 'test_module' from '/removed/for/test/purposes.py'> [m
AssertionError: from __future__ import print_function; [33;1mimport [m better_exceptions; better_exceptions.hook(); a = [31m'why hello ' [m + [31m' there' [m; [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
2017-03-29 00:13:27 +03:00
[33;1mraise [m [35;1mException [m( [31m'this is a test exception' [m)
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
2017-03-29 00:13:27 +03:00
[33;1massert [m baz == [31m90 [m
[36m -> 52 [m
AssertionError: [33;1massert [m baz == [31m90 [m
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
2017-09-05 12:10:19 +03:00
[33;1mreturn [m [31m1 [m / var
[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
2017-09-05 12:10:19 +03:00
[33;1mreturn [m [31m1 [m / var
[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