[openstack-dev] [nova] Proposal new hacking rules
Nicolas Trangez
nicolas.trangez at scality.com
Wed Nov 26 11:20:54 UTC 2014
On Mon, 2014-11-24 at 13:19 -0500, Jay Pipes wrote:
> I think pointing out that the default failure
> message for testtools.TestCase.assertEqual() uses the terms
> "reference"
> (expected) and "actual" is a reason why reviewers *should* ask patch
> submitters to use (expected, actual) ordering.
Is there any reason for this specific ordering? Not sure about others,
but I tend to write equality comparisons like this
if var == 1:
instead of
if 1 == var:
(although I've seen the latter in C code before).
This gives rise to
assert var == 1
or, moving into `unittest` domain
assertEqual(var, 1)
reading it as 'Assert `var` equals 1', which makes me wonder why the
`assertEqual` API is defined the other way around (unlike how I'd write
any other equality check).
Nicolas
More information about the OpenStack-dev
mailing list