expects
1.0.0
Expects是一个用于 Python 的富有表现力且可扩展的TDD/BDD 断言库。可以通过定义新的匹配器来扩展预期。
只需导入expect
可调用和内置匹配器并开始编写测试断言。
from expects import *
expect ([]). to ( be_empty )
expect ( False ). not_to ( be_true )
expect ({
'name' : 'Jack' ,
'email' : '[email protected]'
}). to ( have_key ( 'name' , match ( 'w+' )))
expect ( str ). to ( have_property ( 'split' ) & be_callable )
expect ( lambda : foo ). to ( raise_error ( NameError ))
expect ( 'Foo' ). to ( equal ( 'Bar' ) | equal ( 'Foo' ))
您可以使用 pip 或 easy_install 从 PyPI 安装 Expects 的最新稳定版本。
$ pip install expects
您还可以从 Github 安装最新的源代码。
$ pip install -e git+git://github.com/jaimegildesagredo/expects.git#egg=expects
要运行 Expects 规范,您应该安装开发要求,然后运行 mamba。
$ pip install -r test-requirements.txt
$ mamba
请参阅更改。
请参阅第 3 方匹配器列表。