mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-17 21:32:00 +01:00
qa: Add assert_true()
This follows the style of ASSERT_TRUE() in GoogleTest: https://google.github.io/googletest/reference/assertions.html
This commit is contained in:
parent
0b48f77e10
commit
ae4730ea12
@ -69,6 +69,14 @@ def summarise_dict_differences(thing1, thing2):
|
||||
d2[k] = thing2[k]
|
||||
return d1, d2
|
||||
|
||||
|
||||
def assert_true(condition: bool) -> None:
|
||||
"""Separate from the `assert` keyword in that it should not be optimized out
|
||||
when environment var `PYTHONOPTIMIZE=1`, or Python is run with `-O`."""
|
||||
if not condition:
|
||||
raise AssertionError
|
||||
|
||||
|
||||
def assert_equal(thing1, thing2, *args):
|
||||
if thing1 != thing2 and not args and isinstance(thing1, dict) and isinstance(thing2, dict):
|
||||
d1,d2 = summarise_dict_differences(thing1, thing2)
|
||||
|
Loading…
x
Reference in New Issue
Block a user