assertEquals vs. assertEqual in python

前端 未结 4 1519
难免孤独
难免孤独 2020-12-23 08:25

Is there a difference between assertEquals and assertEqual in the python unittest.TestCase?

And if there is not, why are there

4条回答
  •  难免孤独
    2020-12-23 09:11

    I think this was tension between the "only one obvious way to do it" vs. "alias to make the overall code flow semantically". Personally I found I like to read

    failIf(some_condition)
    

    over

    assertFalse(some_condition)
    

    but liked

    assertEqual(a, b)
    

    over the other two (assertEquals(a, b) bothers my sense of grammar).

    The "only one obvious way to do it" has taken precedence going forward.

提交回复
热议问题