Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python-nose: assertion library?

Is there a library which of nose-friendly assertions things like membership and identity (eg, assert_contains(x, y), assert_is(a, b))?

like image 511
David Wolever Avatar asked Jan 16 '11 05:01

David Wolever


2 Answers

Nose provides stand-alone versions of the stdlib assertions:

from nose.tools import assert_in, assert_is

For older Pythons, the unittest2 versions can likely be wrapped using a technique similar to what's in tools.py.

like image 106
jek Avatar answered Sep 20 '22 18:09

jek


Stdlib unittest provide both assertIn and assertIs and can be run via nose. Are you looking for something other than that? BTW, these methods are available since python 2.7 only and if you want them for older version of python, it is available from unittest2 package

like image 26
Senthil Kumaran Avatar answered Sep 19 '22 18:09

Senthil Kumaran