[issue38296] unittest expectedFailure does not differentiate errors from failures

2019-09-30 Thread Kit Choi
Kit Choi added the comment: See issue38320 for documentation change request -- nosy: +Kit Choi2 ___ Python tracker ___ ___ Python-b

[issue38296] unittest expectedFailure does not differentiate errors from failures

2019-09-28 Thread Kit Yan Choi
Kit Yan Choi added the comment: I think Python does differentiate "test error" and "test failure" such that a test outcome state can be one of these: success, failure, error, skipped. One could refine these to six: expected success, unexpected success, expected failure, unexpected failure, e

[issue38296] unittest expectedFailure does not differentiate errors from failures

2019-09-28 Thread Terry J. Reedy
Terry J. Reedy added the comment: A test either passes or fails. Like a not operator, the expectedFailure decorator inverts the result. https://docs.python.org/3/library/unittest.html#unittest.expectedFailure @unittest.expectedFailure Mark the test as an expected failure. If the test fai

[issue38296] unittest expectedFailure does not differentiate errors from failures

2019-09-28 Thread Kit Yan Choi
Kit Yan Choi added the comment: Pining Chris based on previous discussion in issue16997 ... Hope that's okay. I notice that the language in my initial message also conflates error and failure. My apologies on the carelessness. Just to clarify: @unittest.expectedFailure def test(sel

[issue38296] unittest expectedFailure does not differentiate errors from failures

2019-09-27 Thread Kit Yan Choi
Change by Kit Yan Choi : -- nosy: -Kit Choi ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyt

[issue38296] unittest expectedFailure does not differentiate errors from failures

2019-09-27 Thread Kit Yan Choi
Kit Yan Choi added the comment: For your test: class T(unittest.TestCase): def test_f(self): raise TypeError() If you run this test with unittest test runner, you should get this result: E == ERROR: test_f (test_main.T)

[issue38296] unittest expectedFailure does not differentiate errors from failures

2019-09-27 Thread Terry J. Reedy
Terry J. Reedy 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,

[issue38296] unittest expectedFailure does not differentiate errors from failures

2019-09-27 Thread Kit Choi
New submission from Kit Choi : I expect the following test to fail, because an "error" is not a "failure". Unexpectedly, the test passes: ``` class TestFailure(unittest.TestCase): @unittest.expectedFailure def test_expected_failure(self): raise TypeError() # for example, a ty