Skip to main content

assert with should

Project description

should

https://img.shields.io/travis/Ralph-Wang/should.svg?style-flat-square https://img.shields.io/coveralls/Ralph-Wang/should.svg?style-flat-square https://img.shields.io/pypi/v/should.svg?style-flat-square https://img.shields.io/pypi/dm/should.svg?style-flat-square
所谓断言: tj 之前无 should, tj 之后全 should

安装:

pip install should

使用方法:

from should import it

# 一般的断言
it(1).should.be.int
it({}).should.be.no.ok
it(2).should.be.equal(2)
it(10).should.be.no.equal(8)
it([1,2,3]).should.contain(3)

# with 版异常断言, 不支持 no, 在 0.5 版本会被删除
with should.raises(ValueError):
    int('abc')

# lambda 版异常断言
it(lambda: int('abc')).should.throw(ValueError)
it(lambda: int('123')).should.no.throw(ValueError)

License

The MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

should-0.4.2.tar.gz (2.7 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page