Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a shortcut for self.assertNotEqual() in nose?

_eq seems to be the equal to self.assertEqual()

But is there also a self.assertNotEqual() in nose?

Thanks

like image 448
Houman Avatar asked Oct 14 '13 18:10

Houman


1 Answers

Nose doesn't have an equivalent to self.assertNotEqual(), but you can use all of the unittest.TestCase assert methods via nose.tools. They are renamed to all-lowercase and with underscores. For example:

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

like image 100
nofinator Avatar answered Oct 22 '22 05:10

nofinator