diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py index 03ece6f064a..d6378e880d8 100644 --- a/test/functional/test_framework/util.py +++ b/test/functional/test_framework/util.py @@ -75,7 +75,10 @@ def summarise_dict_differences(thing1, thing2): 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) - raise AssertionError("not(%s == %s)\n in particular not(%s == %s)" % (thing1, thing2, d1, d2)) + if d1 != thing1 or d2 != thing2: + raise AssertionError(f"not({thing1!s} == {thing2!s})\n in particular not({d1!s} == {d2!s})") + else: + raise AssertionError(f"not({thing1!s} == {thing2!s})") if thing1 != thing2 or any(thing1 != arg for arg in args): raise AssertionError("not(%s)" % " == ".join(str(arg) for arg in (thing1, thing2) + args))