kopia lustrzana https://github.com/micropython/micropython-lib
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
rodzic
663a3d6c54
commit
669d343feb
|
|
@ -126,12 +126,13 @@ class TestCase:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
func(*args, **kwargs)
|
func(*args, **kwargs)
|
||||||
assert False, "%r not raised" % exc
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if isinstance(e, exc):
|
if isinstance(e, exc):
|
||||||
return
|
return
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
assert False, "%r not raised" % exc
|
||||||
|
|
||||||
|
|
||||||
def skip(msg):
|
def skip(msg):
|
||||||
def _decor(fun):
|
def _decor(fun):
|
||||||
|
|
|
||||||
Ładowanie…
Reference in New Issue