surer

idiomatic assertion toolkit with human-friendly failure messages, inspired by RSpec Expectations and should.js


Keywords
test, assertions, fluent
License
Apache-2.0
Install
pip install surer==0.0.3

Documentation

surer

https://img.shields.io/pypi/dm/surer https://img.shields.io/readthedocs/sure https://img.shields.io/github/license/getmoto/surer?label=Github%20License https://img.shields.io/pypi/v/surer https://img.shields.io/pypi/l/surer?label=PyPi%20License https://img.shields.io/pypi/format/surer https://img.shields.io/pypi/status/surer https://img.shields.io/pypi/pyversions/surer https://img.shields.io/pypi/implementation/surer

An idiomatic testing library for python with powerful and flexible assertions, created by Gabriel Falcão. Sure's developer experience is inspired and modeled after RSpec Expectations and should.js.

This is a fork of Gabriel's sure library, maintained at http://github.com/getmoto/surer. It provides support for more recent Python-versions, but does not differ in functionality.

Installing

$ pip install surer

Documentation

Available in the website or under the docs directory.

You can also build the documentation locally using sphinx:

make docs

Here is a tease

Equality

(number).should.equal(number)

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

{'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

"Awesome ASSERTIONS".lower().split().should.equal(['awesome', 'assertions'])