Skip to main content

Set of tools for comparing complex objects

Quickstart

equator is available on PyPI and can be installed with pip.

$ pip install equator

After installing equator you can use it like any other Python module.

Here is a simple example:

from equator import equals

item1 = [
    {
        1: [
            {1: [1, 2]},
            [1, 2.0001],
        ],
    },
    [3, [4, [5]]],
]

item2 = [
    {
        1: [
            {1.0001: [1, 2.0001]},
            [1.0001, 1.9999],
        ],
    },
    [2.9999, [4, [5.002]]],
]

result = equals.approx(item1, item2, rel_tol=1e-2)
assert result

The function approx allows one to compare approximately objects of various types.

The motivation to create this function was that pytest.approx does not allow comparison of the complex objects. In contrast, this function allows one iterate through __dict__ of arbitrary objects and make use of math.isclose when encountering numeric types.

TODO

Currently one may expect issues with sets and Decimal.

Change Log

Version History

0.0.1
  • Project created.

Metadata

Release files for equator 0.0.1

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

Built distribution (wheel)

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

Release files / equator-0.0.1-py3-none-any.whl

Download URL equator-0.0.1-py3-none-any.whl
Size 3.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a42f5ea14a65c1d6681f215a83aa1da1dcd41ce93507b06b68fe9a5f980aa00b
BLAKE2b-256 checksum
How to use checksums
d0bbf566ed918b6986f47aef1450e9073b4c22a17d6f85c0bfe6453c2c0f151d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.0

Security for equator 0.0.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.

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 release file No provenance

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