Skip to main content

Utilities to aid in testing for equality.

Project description

This package is pre-alpha. The API may change.

When comparing structures like this dict:

assert actual == {
'id': 123,
'created': "2017-11-10T23:59:58",
'field1': 1,
...
}

This fails because `id` and `created` are different every test run. Fix this
using:

assert actual == {
'id': AnyInt(),
'created': Timestamp(datetime.now(), seconds=3),
'field1': 1,
...
}

`AnyInt` compares equal to any integer. `Timestamp` compares equal to string
timestamps that are within the given number of seconds.


Compatibility
-------------

Runs on Python 3.6 and 2.7.


Known Problems
--------------

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


Alternatives
------------

This doubtless duplicates better work elsewhere. In particular the package
'equals' looks very nice, but it's missing the central feature of 'equality',
approximate comparison of string timestamps.


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.4.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

equality-0.0.4-py2.py3-none-any.whl (4.7 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

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

File hashes

Hashes for equality-0.0.4.tar.gz
Algorithm Hash digest
SHA256 96a19489365582ecbbf935df9d7e54a8d011c284a19d0c941fdbce04eb174543
MD5 27d3bc586dae69ee3688ba36580d6afb
BLAKE2b-256 718b78075d634823d5ae0e3f8159e7c483b0a5e8fba155fc9a0447d1f3f68abd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for equality-0.0.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f8770e87e76e8c13c17503fd68d97c0e4712d9c0627a8391266f818ddd02ced9
MD5 1ccb1f885a94f9311f72651dd2b933f4
BLAKE2b-256 51d1db7619c86a9c69f2ff9ebdab135545dd49e76e932fcd131dc874131ec69b

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