Terry J. Reedy <[email protected]> added the comment:
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)
----------
nosy: +terry.reedy
resolution: -> not a bug
stage: -> resolved
status: open -> closed
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue38296>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com