The Problem:
We've been using nose
test runner for quite a while.
From time to time, I see our tests having eq_()
calls:
eq_(actual, expected)
instead of the common:
self.assertEqual(actual, expected)
The question:
Is there any benefit of using nose.tools.eq_
as opposed to the standard unittest framework's assertEqual()
? Are they actually equivalent?
Thoughts:
Well, for one, eq_
is shorter, but it has to be imported from nose.tools
which makes the tests dependent on the test runner library which can make it more difficult to switch to a different test runner, say py.test
. On the other hand, we are also using @istest
, @nottest
and @attr
nose decorators a lot.
Aucun commentaire:
Enregistrer un commentaire