| 1 |
sure |
| 2 |
==== |
| 3 |
|
| 4 |
.. image:: https://img.shields.io/pypi/dm/sure |
| 5 |
:target: https://pypi.org/project/sure |
| 6 |
|
| 7 |
.. image:: https://github.com/gabrielfalcao/sure/workflows/Sure%20Tests/badge.svg |
| 8 |
:target: https://github.com/gabrielfalcao/sure/actions?query=workflow%3A%22Sure+Tests%22 |
| 9 |
|
| 10 |
.. image:: https://img.shields.io/readthedocs/sure |
| 11 |
:target: https://sure.readthedocs.io/ |
| 12 |
|
| 13 |
.. image:: https://img.shields.io/github/license/gabrielfalcao/sure?label=Github%20License |
| 14 |
:target: https://github.com/gabrielfalcao/sure/blob/master/LICENSE |
| 15 |
|
| 16 |
.. image:: https://img.shields.io/pypi/v/sure |
| 17 |
:target: https://pypi.org/project/sure |
| 18 |
|
| 19 |
.. image:: https://img.shields.io/pypi/l/sure?label=PyPi%20License |
| 20 |
:target: https://pypi.org/project/sure |
| 21 |
|
| 22 |
.. image:: https://img.shields.io/pypi/format/sure |
| 23 |
:target: https://pypi.org/project/sure |
| 24 |
|
| 25 |
.. image:: https://img.shields.io/pypi/status/sure |
| 26 |
:target: https://pypi.org/project/sure |
| 27 |
|
| 28 |
.. image:: https://img.shields.io/pypi/pyversions/sure |
| 29 |
:target: https://pypi.org/project/sure |
| 30 |
|
| 31 |
.. image:: https://img.shields.io/pypi/implementation/sure |
| 32 |
:target: https://pypi.org/project/sure |
| 33 |
|
| 34 |
.. image:: https://img.shields.io/github/v/tag/gabrielfalcao/sure |
| 35 |
:target: https://github.com/gabrielfalcao/sure/releases |
| 36 |
|
| 37 |
.. image:: https://img.shields.io/badge/pydoc-web-ff69b4.svg |
| 38 |
:target: http://pydoc.net/sure |
| 39 |
|
| 40 |
An idiomatic testing library for python with powerful and flexible assertions, created by `Gabriel Falcão <https://github.com/gabrielfalcao>`_. |
| 41 |
Sure's developer experience is inspired and modeled after `RSpec Expectations |
| 42 |
<http://rspec.info/documentation/3.5/rspec-expectations/>`_ and |
| 43 |
`should.js <https://github.com/shouldjs/should.js>`_. |
| 44 |
|
| 45 |
Installing |
| 46 |
---------- |
| 47 |
|
| 48 |
.. code:: bash |
| 49 |
|
| 50 |
$ pip install sure |
| 51 |
|
| 52 |
Documentation |
| 53 |
------------- |
| 54 |
|
| 55 |
Available in the `website <https://sure.readthedocs.io/en/latest/>`__ or under the |
| 56 |
``docs`` directory. |
| 57 |
|
| 58 |
You can also build the documentation locally using sphinx: |
| 59 |
|
| 60 |
.. code:: bash |
| 61 |
|
| 62 |
make docs |
| 63 |
|
| 64 |
Here is a tease |
| 65 |
--------------- |
| 66 |
|
| 67 |
Equality |
| 68 |
~~~~~~~~ |
| 69 |
|
| 70 |
(number).should.equal(number) |
| 71 |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 72 |
|
| 73 |
.. code:: python |
| 74 |
|
| 75 |
import sure |
| 76 |
|
| 77 |
(4).should.be.equal(2 + 2) |
| 78 |
(7.5).should.eql(3.5 + 4) |
| 79 |
|
| 80 |
(3).shouldnt.be.equal(5) |
| 81 |
|
| 82 |
Assert dictionary and its contents |
| 83 |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 84 |
|
| 85 |
.. code:: python |
| 86 |
|
| 87 |
{'foo': 'bar'}.should.equal({'foo': 'bar'}) |
| 88 |
{'foo': 'bar'}.should.have.key('foo').which.should.equal('bar') |
| 89 |
|
| 90 |
"A string".lower().should.equal("a string") also works |
| 91 |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 92 |
|
| 93 |
.. code:: python |
| 94 |
|
| 95 |
"Awesome ASSERTIONS".lower().split().should.equal(['awesome', 'assertions']) |