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:

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.1.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.1-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mismatcha-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 84fce273d01a716345cefc38d924adf9f4ce199a177bc6689176ea6c2ac148a9
MD5 72ca467b7a9c9059f2b2d50bc93282aa
BLAKE2b-256 95b3218c129eb1ac80b5125e9144b7ae06c2a41416067eb51aa2475278fec12d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mismatcha-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.2 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 26ea4f2507de4adae89aeb3051c39faec7b0750007dd817f167fc7d28bd9a287
MD5 6ba3fa5590de5db5ffb9489bb9c36e24
BLAKE2b-256 405a0ae934337523c12e79eb26007110a2a993385c2c05557e47bb0901a3999d

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