Skip to main content

version travis coveralls license

Verify is a painless assertion library for Python.

Quickstart

Install using pip:

pip install verify

Verify some value using verify’s assertions:

import verify
from verify import Expect, Not

Expect(5 * 5,
       verify.Truthy(),
       Not(verify.Falsy),
       verify.Greater(15),
       verify.Less(30))

Expect(lambda: 5 * 5,
       verify.GreaterEqual(15),
       verify.Less(30))

Verify using your own functions:

def is_just_right(value):
    assert 20 <= value <= 30, "it's just not right"

# Passes
Expect(25, is_just_right)

# Fails
try:
    Expect(31, is_just_right)
except AssertionError:
    raise

Under the hood the value that’s passed to Expect will be piped through all of the assertion callables that are passed to it.

You can also use the verify assertions on their own:

# These will pass.
verify.Truthy(1)
verify.Equal(2, 2)
verify.Greater(3, 2)

# These will fail with an AssertionError
verify.Truthy(0)
verify.Equal(2, 3)
verify.Greater(2, 3)

Validators

All of the validators in verify are callables that can be used in two contexts:

  1. By themselves as in Equal(a, b) which will raise an AssertionError if false.

  2. In combination with Except as in Expect(a, Equal(b)).

The available validators are:

Validator

Description

Not

Assert the negation of a callable

Equal

Assert that a == b

Greater

Assert that a > b

GreaterEqual

Assert that a >= b

Less

Assert that a < b

LessEqual

Assert that a <= b

Is

Assert that a is b

In

Assert that a in b

InstanceOf

Assert that isinstance(a, b)

Truthy

Assert that bool(a)

Falsy

Assert that not bool(a)

IsNone

Assert that a is None

For more details, please see the full documentation at http://verify.readthedocs.org.

Release files for verify 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for verify 0.0.1
File Size Uploaded
verify-0.0.1.tar.gz 5.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for verify 0.0.1
File Interpreter ABI Platform
verify-0.0.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 11.5 kB

Release files / verify-0.0.1.tar.gz

Download URL verify-0.0.1.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c9c5ff77ff76eec4a11cd3b3387cd98de43bbecae360b83f35116957791b74ec
BLAKE2b-256 checksum
How to use checksums
d8fee5686d4d73dde85bb7a733aaf808bb03b22175235d4616f239c2c9fe4a11
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / verify-0.0.1-py2.py3-none-any.whl

Download URL verify-0.0.1-py2.py3-none-any.whl
Size 6.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
9449c721bdae222ade50e7d486bdb1222e9c0b240d12c56d5eb35827604bd628
BLAKE2b-256 checksum
How to use checksums
d5ce17bef81d706c639540b0ef54aa6ebc74ba496cc98969841ba1fe12df1583
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page