鼻子中有self.assertNotEqual()的快捷方式吗?

时间:2013-10-14 18:33:51

标签: python unit-testing nose

_eq似乎等于self.assertEqual()

但鼻子里还有一个self.assertNotEqual()吗?

由于

1 个答案:

答案 0 :(得分:4)

Nose没有等效于self.assertNotEqual(),但您可以通过unittest.TestCase使用所有nose.tools断言方法。它们被重命名为全小写并带有下划线。例如:

>>> from nose.tools import assert_not_equal
>>> assert_not_equal(1, 1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py", line 518, in assertNotEqual
    raise self.failureException(msg)
AssertionError: 1 == 1

More info here.