Search code examples
pythonnosetestsassertion

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))?


Solution

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