1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
|
python3 test/test.py
Traceback (most recent call last):
File "/removed/for/test/purposes.ext", line 17, in <module>
shallow(bar, [31m15[m)
[36m│ └ 2[m
[36m└ <function shallow at 0xDEADBEEF>[m
File "/removed/for/test/purposes.ext", line 8, in shallow
deep(a + b)
[36m│ │ └ 15[m
[36m│ └ 2[m
[36m└ <function deep at 0xDEADBEEF>[m
File "/removed/for/test/purposes.ext", line 13, in deep
[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
python3 test/test_encoding.py
Traceback (most recent call last):
File "/removed/for/test/purposes.ext", line 14, in <module>
div()
[36m└ <function div at 0xDEADBEEF>[m
File "/removed/for/test/purposes.ext", line 11, in div
[33;1mreturn[m _deep([31m'天'[m)
[36m └ <function _deep at 0xDEADBEEF>[m
File "/removed/for/test/purposes.ext", line 8, in _deep
[33;1mreturn[m [31m1[m / val
[36m └ '天'[m
TypeError: unsupported operand type(s) for /: 'int' and 'str'
./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
import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine
Traceback (most recent call last):
File "<string>", line 1, in <module>
[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
Traceback (most recent call last):
File "<string>", line 1, in <module>
[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
from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False
Traceback (most recent call last):
File "<string>", line 1, in <module>
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 [31mFalse[m
[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 [31mFalse[m
why hello there
Traceback (most recent call last):
File "<string>", line 1, in <module>
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 [31mFalse[m
[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 [31mFalse[m
why hello there
from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False
Traceback (most recent call last):
File "<string>", line 1, in <module>
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 [31mFalse[m
[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 [31mFalse[m
why hello there
Traceback (most recent call last):
File "<string>", line 1, in <module>
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 [31mFalse[m
[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 [31mFalse[m
why hello there
python3 test/test_logging.py
ERROR:__main__:callback failed
Traceback (most recent call last):
File "/removed/for/test/purposes.ext", line 16, in foo
cb()
[36m└ <function bar3 at 0xDEADBEEF>[m
File "/removed/for/test/purposes.ext", line 33, in bar3
[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):
File "/removed/for/test/purposes.ext", line 16, in foo
cb()
[36m└ <function bar4 at 0xDEADBEEF>[m
File "/removed/for/test/purposes.ext", line 38, in bar4
[33;1massert[m baz == [31m90[m
[36m └ 52[m
AssertionError: [33;1massert[m baz == [31m90[m
python3 test/test_truncating.py
Traceback (most recent call last):
File "/removed/for/test/purposes.ext", line 12, in <module>
div()
[36m└ <function ...[m
File "/removed/for/test/purposes.ext", line 9, in div
[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):
File "/removed/for/test/purposes.ext", line 12, in <module>
div()
[36m└ <function div at 0xDEADBEEF>[m
File "/removed/for/test/purposes.ext", line 9, in div
[33;1mreturn[m [31m1[m / var
[36m └ '999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999'[m
TypeError: unsupported operand type(s) for /: 'int' and 'str'
python3 test/test_indentation_error.py
Traceback (most recent call last):
File "/removed/for/test/purposes.ext", 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 "/removed/for/test/purposes.ext", 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
|