python的延迟/软断言
delayed-assert的Python项目详细描述
python延迟断言
推迟了。python的软断言
功能很少:
- No Dependenices on any other framework/library.
- Should work with any testing framework.
- Can be use as decorator or context manager.
安装
通过PIP安装
pip install delayed-assert
从主服务器安装
pip install git+https://github.com/pr4bh4sh/python-delayed-assert
使用
有关用法,请参见ExampleUnittest.py
。
在lambda
中使用断言库将断言调用传递为
lambda:self.assertListEqual([4,5,6,2,5],[7,8])
虽然我只使用unittest assertion进行了测试,但它应该能够使用任何断言库。
请记住,python不支持lambda中的语句,因此
lambda:assert1==1
无法工作,因为它在python中不是有效的lambda表达式
学分:http://pythontesting.net/strategy/delayed-assert/