unittest: Allow to catch AssertionError with assertRaises().

Without this change, current implementaiton produces a false positive
result for AssertionError type.

Example of falsely passing test code:

def test(a, b):
    assert a > 10
    assert b > 10

self.assertRaises(AssertionError, test, 20, 20)
pull/488/head
sss 2018-10-31 15:59:56 +11:00 zatwierdzone przez Andrew Leech
rodzic 663a3d6c54
commit 669d343feb
1 zmienionych plików z 2 dodań i 1 usunięć

Wyświetl plik

@ -126,12 +126,13 @@ class TestCase:
try:
func(*args, **kwargs)
assert False, "%r not raised" % exc
except Exception as e:
if isinstance(e, exc):
return
raise
assert False, "%r not raised" % exc
def skip(msg):
def _decor(fun):