开发者

python-nose: assertion library?

开发者 https://www.devze.com 2023-02-04 06:06 出处:网络
Is there a li开发者_运维知识库brary which of nose-friendly assertions things like membership and identity (eg, assert_contains(x, y), assert_is(a, b))?Nose provides stand-alone versions of the stdlib

Is there a li开发者_运维知识库brary which of nose-friendly assertions things like membership and identity (eg, assert_contains(x, y), assert_is(a, b))?


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消