Skip to main content

Utilities to aid in testing for equality.

Project description

Help with failing asserts like:

assert actual == {
    'id': 123,
    'field1': 1,
    ...
}

Where ‘id’ is generated by the database and is different every test run. Fix this using ‘AnyInt’:

assert actual == {
    'id': AnyInt(),
    'field1': 1,
    ...
}

Instances of AnyInt compare equal to any integer. So this assertion will now pass if and only if the value of the ‘id’ field is an int.

There are other classes for use in other situations.

Dependencies

Written on Python 2.7 (sorry), but it’s a bug if it doesn’t work on 3 as well.

Install

pip install equality

Plans

Slowly add occasional new classes as the need arises.

Known Problems

It’s hot of the presses, so is doubtless full of mistakes.

Alternatives

This doubtless duplicates better work elsewhere. Let me know and I’ll happily delete this project.

Thanks

To all the good folks formerly of Resolver Systems.

Contact

For users:

Downloads & documentation: http://pypi.python.org/pypi/equality/

For developers:

Souce code & issues: https://github.com/tartley/equality/

Contact the author:

Jonathan Hartley, email: tartley at domain tartley.com, Twitter: @tartley.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

equality-0.0.3.tar.gz (4.6 kB view hashes)

Uploaded Source

Built Distribution

equality-0.0.3-py2.py3-none-any.whl (5.0 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page