未提供项目描述
项目描述
surer
.. image:: https://img.shields.io/pypi/dm/surer :target: https://pypi.ac.cn/project/surer
.. image:: https://github.com/getmoto/surer/workflows/Sure%20Tests/badge.svg :target: https://github.com/getmoto/surer/actions?query=workflow%3A%22Sure+Tests%22
.. image:: https://img.shields.io/readthedocs/sure :target: https://surer.readthedocs.io/
.. image:: https://img.shields.io/github/license/getmoto/surer?label=Github%20License :target: https://github.com/getmoto/surer/blob/master/LICENSE
.. image:: https://img.shields.io/pypi/v/surer :target: https://pypi.ac.cn/project/surer
.. image:: https://img.shields.io/pypi/l/surer?label=PyPi%20License :target: https://pypi.ac.cn/project/surer
.. image:: https://img.shields.io/pypi/format/surer :target: https://pypi.ac.cn/project/surer
.. 图片:: https://img.shields.io/pypi/status/surer :target: https://pypi.ac.cn/project/surer
.. 图片:: https://img.shields.io/pypi/pyversions/surer :target: https://pypi.ac.cn/project/surer
.. 图片:: https://img.shields.io/pypi/implementation/surer :target: https://pypi.ac.cn/project/surer
这是一个用于Python的惯用测试库,具有强大灵活的断言功能,由Gabriel Falcão <https://github.com/gabrielfalcao>
创建。Sure的开发者体验受到RSpec Expectations <https://rspec.ruby-lang.org.cn/documentation/3.5/rspec-expectations/>
和should.js <https://github.com/shouldjs/should.js>
的启发和模仿。
这是Gabriel的sure
库的分支,维护在http://github.com/getmoto/surer
。它支持更新的Python版本,但功能上没有区别。
安装
.. code:: bash
$ pip install surer
文档
可在网站 <https://surer.readthedocs.io/en/latest/>
或docs
目录下找到。
您也可以使用sphinx本地构建文档。
.. code:: bash
make docs
这是一个预告
等价性
(number).should.equal(number)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. code:: python
import surer
(4).should.be.equal(2 + 2)
(7.5).should.eql(3.5 + 4)
(3).shouldnt.be.equal(5)
Assert dictionary and its contents
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. code:: python
{'foo': 'bar'}.should.equal({'foo': 'bar'})
{'foo': 'bar'}.should.have.key('foo').which.should.equal('bar')
"A string".lower().should.equal("a string") also works
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. code:: python
"Awesome ASSERTIONS".lower().split().should.equal(['awesome', 'assertions'])
项目详情
下载文件
下载适合您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。