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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 2 Python 3

File details

Details for the file equality-0.0.3.tar.gz.

File metadata

  • Download URL: equality-0.0.3.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for equality-0.0.3.tar.gz
Algorithm Hash digest
SHA256 ef17c1edbb02defd976573e5101cc88e4d19c9cb2503deb2f1e74de6d18bf5c7
MD5 06f6d7c8c2c3f73d0f915d3d752c0902
BLAKE2b-256 3b3a87ba6762b103af2724d452fee4c5b7448d84c6ab4406010bb677444de5ca

See more details on using hashes here.

File details

Details for the file equality-0.0.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for equality-0.0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1c8f70624f8a93a7eeca5c4565a82a237d24c561624abe124fd4d127d25d8515
MD5 4a5ce9cfdc73c7993d487466b314ef54
BLAKE2b-256 3034f61a166edc1125af5e40ed7d7d35e1c9f8a415a7564ff4af1f9ff2437f98

See more details on using hashes here.

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