better-exceptions/test/output/python3-xterm-ascii-color.out
2020-12-23 02:20:19 +01:00

11 KiB

python3 test/test.py
 
 
Traceback (most recent call last):
File "test/test.py", line 17, in <module>
shallow(bar, 15)
| -> 2
-> <function shallow at 0xDEADBEEF>
File "test/test.py", line 8, in shallow
deep(a + b)
| | -> 15
| -> 2
-> <function deep at 0xDEADBEEF>
File "test/test.py", line 13, in deep
assert val > 10 and foo == 60
| -> 52
-> 17
AssertionError: assert val > 10 and foo == 60
 
 
 
python3 test/test_color.py
 
 
True
 
 
 
python3 test/test_encoding.py
 
 
Traceback (most recent call last):
File "test/test_encoding.py", line 14, in <module>
div()
-> <function div at 0xDEADBEEF>
File "test/test_encoding.py", line 11, in div
return _deep("天")
-> <function _deep at 0xDEADBEEF>
File "test/test_encoding.py", line 8, in _deep
return 1 / val
-> '天'
TypeError: unsupported operand type(s) for /: 'int' and 'str'
 
 
 
./test/test_interactive.sh
 
 
spawn python -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(1)
-> <function foo at 0xDEADBEEF>
File "<console>", line 2, in foo
assert a > 10
-> 1
AssertionError: assert a > 10
>>> 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>
import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine
| | -> 5
| -> 5
-> <module 'test_module' from '/removed/for/test/purposes.py'>
AssertionError: 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>
import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine
| | -> 5
| -> 5
-> <module 'test_module' from '/removed/for/test/purposes.py'>
AssertionError: import better_exceptions; better_exceptions.hook(); a = 5; assert a > 10 # this should work fine
 
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; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False
| | -> 'why hello there'
| -> 'why hello there'
-> <module 'test_module' from '/removed/for/test/purposes.py'>
AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False
why hello there
 
Traceback (most recent call last):
File "<string>", line 1, in <module>
from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False
| | -> 'why hello there'
| -> 'why hello there'
-> <module 'test_module' from '/removed/for/test/purposes.py'>
AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello there"; print(a); assert False
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; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False
| | -> 'why hello there'
| -> 'why hello there'
-> <module 'test_module' from '/removed/for/test/purposes.py'>
AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False
why hello there
 
Traceback (most recent call last):
File "<string>", line 1, in <module>
from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False
| | -> 'why hello there'
| -> 'why hello there'
-> <module 'test_module' from '/removed/for/test/purposes.py'>
AssertionError: from __future__ import print_function; import better_exceptions; better_exceptions.hook(); a = "why hello " + " there"; print(a); assert False
why hello there
 
 
 
python3 test/test_logging.py
 
 
ERROR:__main__:callback failed
Traceback (most recent call last):
File "test/test_logging.py", line 16, in foo
cb()
-> <function bar3 at 0xDEADBEEF>
File "test/test_logging.py", line 33, in bar3
raise Exception('this is a test exception')
Exception: this is a test exception
 
ERROR:__main__:callback failed
Traceback (most recent call last):
File "test/test_logging.py", line 16, in foo
cb()
-> <function bar4 at 0xDEADBEEF>
File "test/test_logging.py", line 38, in bar4
assert baz == 90
-> 52
AssertionError: assert baz == 90
 
 
 
 
python3 test/test_truncating.py
 
 
Traceback (most recent call last):
File "test/test_truncating.py", line 12, in <module>
div()
-> <function ...
File "test/test_truncating.py", line 9, in div
return 1 / var
-> '999999999...
TypeError: unsupported operand type(s) for /: 'int' and 'str'
 
 
 
python3 test/test_truncating_disabled.py
 
 
Traceback (most recent call last):
File "test/test_truncating_disabled.py", line 12, in <module>
div()
-> <function div at 0xDEADBEEF>
File "test/test_truncating_disabled.py", line 9, in div
return 1 / var
-> '999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999'
TypeError: unsupported operand type(s) for /: 'int' and 'str'
 
 
 
python3 test/test_indentation_error.py
 
 
Traceback (most recent call last):
File "test/test_indentation_error.py", line 13, in <module>
exec(code)
-> '\nif True:\n a = 5\n print("foobar") #intentional faulty indentation here.\n b = 7\n'
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>
exec(code)
-> '\nif True:\n a = 5\n b = 7 *\n'
File "<string>", line 4
b = 7 *
^
SyntaxError: invalid syntax
 
 
 
python3 test/test_unittest_patch.py
 
 
return a + b
TypeError: unsupported operand type(s) for +: 'int' and 'str'
self._callTestMethod(testMethod)
| -> <bound method MyTestCase.test_add of <__main__.MyTestCase testMethod=test_add>>
-> <__main__.MyTestCase testMethod=test_add>
File "/removed/for/test/purposes.ext", line 633, in _callTestMethod
method()
-> <bound method MyTestCase.test_add of <__main__.MyTestCase testMethod=test_add>>
File "test/test_unittest_patch.py", line 15, in test_add
self.assertEqual(add(1, "2"), 3)
| -> <function add at 0xDEADBEEF>
-> <__main__.MyTestCase testMethod=test_add>
File "test/test_unittest_patch.py", line 10, in add
return a + b
| -> '2'
-> 1
TypeError: unsupported operand type(s) for +: 'int' and 'str'
 
 
 
python3 test/test_chaining.py
 
 
Traceback (most recent call last):
File "test/test_chaining.py", line 11, in cause
div(x, y)
| | -> 0
| -> 1
-> <function div at 0xDEADBEEF>
File "test/test_chaining.py", line 7, in div
x / y
| -> 0
-> 1
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)
| | -> 0
| -> 1
-> <function cause at 0xDEADBEEF>
File "test/test_chaining.py", line 13, in cause
raise ValueError("Division error")
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>
context(1, 0)
-> <function context at 0xDEADBEEF>
File "test/test_chaining.py", line 19, in context
raise ValueError("Cause error") from e
ValueError: Cause error