Skip to main content

Travis Test Status

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': AnyTimestamp(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

Python 3.6 and 2.7.

Known Problems

If timestamps are generated locally, in-process, then it’s easier to patch out datetime.now(). But if this is an end-to-end test that hits other services, that might not be an option. That’s when I find AnyTimestamp useful.

This is all hot off the press, 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

Users’ downloads & documentation: http://pypi.python.org/pypi/equality/
Contributors’ souce & issues: https://github.com/tartley/equality/
Author: Jonathan Hartley, email: tartley at domain tartley.com, Twitter: @tartley.

Metadata

Release files for equality 0.1.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 equality 0.1.1
File Size Uploaded Provenance
equality-0.1.1.tar.gz 4.6 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 9.6 kB

Release files / equality-0.1.1.tar.gz

Download URL equality-0.1.1.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
4342928f394b538eb633a691a8ef6a1fcfd2d26ca33c220ec481b767a5bb9f41
BLAKE2b-256 checksum
How to use checksums
37b43e3b51e5759969073b9aab95fc079cff04e6d4271ff352fe93d5957fb0a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / equality-0.1.1-py2.py3-none-any.whl

Download URL equality-0.1.1-py2.py3-none-any.whl
Size 5.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
1f820eb75b18847286cdd6c5c5582481e67110d1a21465a558fcc165808a8c02
BLAKE2b-256 checksum
How to use checksums
227faea0fdbceddb55c4eef88d92769e108bce001a7bbeb7134b7dfa6ce2cc23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for equality 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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