Skip to main content

Yes, another compare tool

Project description

A tool for comparison of JSON-like structures.

It recursively walks through both structures and reports any mismatches found, such as:

  • missing keys in dict
  • type mismatch
  • value mismatch
  • list length difference

Usage:

Call:

from mismatcha import compare


d1 = {
    "user": {
        "id": 512341,
        "name": "Alex",
        "active": True,
        "score": 4.5,
        "tags": ["qa", "python", {"extra": False}]
    }
}

d2 = {
    "user": {
        "id": 6512,
        "active": "yes",
        "score": 4.5,
        "tags": ["qa", "python", {"extra": True}]
        "extra_param": "boo!"
    }
}

compare(expected=d1, actual=d2, ignore=["user.tags.extra"])
Output:

[user.id] Value mismatch 
Expected: 512341 (int) 
Actual: 6512 (int)

[user.name] Param not found 
Expected: name (str) 
Actual: None (NoneType)

[user.active] Type mismatch 
Expected: True (bool) 
Actual: yes (str)

Comparison rules:

  • dicts are compared only by keys present in the expected structure (extra keys in the actual will be ignored)
  • lists are compared by index (order matters)
  • int and float are treated as compatible numeric types
  • Anything other than dict/list will be compared as is

Install: pip install mismatcha

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

mismatcha-0.1.2.tar.gz (2.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mismatcha-0.1.2-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file mismatcha-0.1.2.tar.gz.

File metadata

  • Download URL: mismatcha-0.1.2.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for mismatcha-0.1.2.tar.gz
Algorithm Hash digest
SHA256 33b85d1c63978d2f35055fda9ff60d5c1e35c16d5aee2ce153499ff4924fdefe
MD5 f68dea45843b97a21734c58eb2eea464
BLAKE2b-256 381cefe003c3bbf03a81cafc3dcdf1df83a9acee3665c357c1f72a8e8ad4db3e

See more details on using hashes here.

File details

Details for the file mismatcha-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: mismatcha-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for mismatcha-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ef33efebd671c4f57d65b69ebbd6fc07f3f16c7817d68a568b64f4e3d7bd403a
MD5 a673a0a797b2b42891c2b0d73075ebea
BLAKE2b-256 ae45f7d655a618d8ff190eacedef5e092ee44dc4a5b443383093a199047e9814

See more details on using hashes here.

Supported by

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