For historical reasons, some of the TestCase methods had one or more aliases that are now deprecated. The following table lists the correct names along with their deprecated aliases:
Method Name | Deprecated alias | Deprecated alias
--------------+------------------+-----------------
assertEqual() | failUnlessEqual | assertEquals
...
3.3更新:来自26.3.7.1.1. Deprecated aliases:
好问题!
实际上,在Python 2.6中,
assertEqual
和assertEquals
都是failUnlessEqual
的方便别名。消息来源这样声明:在Python 3中,就您的观点而言,
failUnlessEqual
被显式地弃用。assertEquals
带有以下注释:-)因此,结果似乎是您应该为Python 2.x使用您喜欢的任何东西,但对于Python 3则倾向于
assertEqual
。不仅仅是对于Python 3.x,因为Python 2.7
assertEquals
也被弃用:从25.3.7.1.1. Deprecated aliases
相关问题 更多 >
编程相关推荐