Skip to content

Latest commit

 

History

History
48 lines (30 loc) · 1011 Bytes

R.rst

File metadata and controls

48 lines (30 loc) · 1011 Bytes

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

Bugs: https://github.com/Ralph-Wang/should/issues More Details: https://github.com/Ralph-Wang/should/blob/master/README.md

安装:

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)

# lambda 版异常断言
it(lambda: int('abc')).should.throw(ValueError)
it(lambda: int('123')).should.no.throw(ValueError)
  • 更多例子请参考 tests

License

The MIT License