Message353411
A function can fail to return an expected object by either returning a wrong object or raising an (unexpected) exception. The assertXyz methods, which ultimately raise AssertionError or something similar, are mostly about catching the first kind of failure, but tests should also catch and report the second kind. The traceback shows the kind of failure. The assertXyx failures add additional details after the traceback.
import unittest
class T(unittest.TestCase):
def test_f(self): raise TypeError()
unittest.main()
# Properly results in
Traceback (most recent call last):
File "F:\Python\a\tem4.py", line 4, in test_f
def test_f(self): raise TypeError()
TypeError
----------------------------------------------------------------------
Ran 1 test in 0.050s
FAILED (errors=1) |
|
Date |
User |
Action |
Args |
2019-09-27 21:00:16 | terry.reedy | set | recipients:
+ terry.reedy, Kit Choi |
2019-09-27 21:00:16 | terry.reedy | set | messageid: <1569618016.93.0.190006288333.issue38296@roundup.psfhosted.org> |
2019-09-27 21:00:16 | terry.reedy | link | issue38296 messages |
2019-09-27 21:00:16 | terry.reedy | create | |
|