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 theexpectedstructure (extra keys in theactualwill be ignored)lists are compared by index (order matters)intandfloatare treated as compatible numeric types- Anything other than
dict/listwill 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)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33b85d1c63978d2f35055fda9ff60d5c1e35c16d5aee2ce153499ff4924fdefe
|
|
| MD5 |
f68dea45843b97a21734c58eb2eea464
|
|
| BLAKE2b-256 |
381cefe003c3bbf03a81cafc3dcdf1df83a9acee3665c357c1f72a8e8ad4db3e
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef33efebd671c4f57d65b69ebbd6fc07f3f16c7817d68a568b64f4e3d7bd403a
|
|
| MD5 |
a673a0a797b2b42891c2b0d73075ebea
|
|
| BLAKE2b-256 |
ae45f7d655a618d8ff190eacedef5e092ee44dc4a5b443383093a199047e9814
|