gpt4 book ai didi

python - nose 中有 self.assertNotEqual() 的快捷方式吗?

转载 作者:太空狗 更新时间:2023-10-30 00:07:28 25 4
gpt4 key购买 nike

_eq 似乎等于 self.assertEqual()

但是 nose 中是否也有 self.assertNotEqual()

谢谢

最佳答案

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

>>> 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.

关于python - nose 中有 self.assertNotEqual() 的快捷方式吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19366825/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com