Currently assert_equal is defined as follows:
def assert_equal(thing1, thing2, *args):
if thing1 != thing2 or any(thing1 != arg for arg in args):
raise AssertionError("not(%s)" % " == ".join(str(arg) for arg in (thing1, thing2) + args))
[source]
It works correctly. But one consequence of this definition is that people can write:
assert_equal(computation_result, 1)orassert_equal(1, computation_result)
which I find undesirable because sometimes it may not be that clear what is expectation and what is the actual result. For new contributors it may be an issue too as they typically don't know Bitcoin Core codebase that well.
For these reasons, it would make sense to me to change the method signature as follows:
def assert_equal(thing1, thing2, *args):
->
def assert_equal(expected, actual, *args): # (1)
Unfortunately, it seems that people use it more in the following way:
def assert_equal(actual, expected, *args): # (2)
which seems slightly worse in the sense that one checks then equality of the second parameter with the first one, the third one, the fourth one, etc.
What you do think? Would it make sense to change the original assert_equal method signature with either (1) or (2) one?
Edit: If there is an agreement that this is a good idea, I'm willing to create a PR for this.