mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-09 15:00:58 +00:00
core/tests: fix inline variant of assertRaises
otherwise code like the following would fail: >>> self.assertRaises(AssertionError, ensure, False) because the AssertionError raised internally by `ensure` would be conflated with the AssertionError raised by the tested function
This commit is contained in:
parent
da89a17ce5
commit
a9faa4d4ab
@ -119,11 +119,12 @@ class TestCase:
|
||||
return AssertRaisesContext(exc)
|
||||
try:
|
||||
func(*args, **kwargs)
|
||||
ensure(False, "%r not raised" % exc)
|
||||
except Exception as e:
|
||||
if isinstance(e, exc):
|
||||
return
|
||||
raise
|
||||
else:
|
||||
ensure(False, "%r not raised" % exc)
|
||||
|
||||
def assertListEqual(self, x, y, msg=''):
|
||||
if len(x) != len(y):
|
||||
|
Loading…
Reference in New Issue
Block a user