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:
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.3.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.3.tar.gz.
File metadata
- Download URL: mismatcha-0.1.3.tar.gz
- Upload date:
- Size: 2.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","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 |
8f5c95e92294118ccdc71a157b3d30a114dd9463a6bb09a043d58c0da3fed05e
|
|
| MD5 |
6733daf426cfc581e92ebb24c9d1313d
|
|
| BLAKE2b-256 |
522f9b523a9b005ea6776713e21510ce55979afb43ff9122d5fcdfc53de78b72
|
File details
Details for the file mismatcha-0.1.3-py3-none-any.whl.
File metadata
- Download URL: mismatcha-0.1.3-py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","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 |
5f9068653798ff050b7bef0271c4c90e22824af58cab0f684f1ea7c8bbd18d71
|
|
| MD5 |
67e94ddc900a6e7c5aa7125785b43316
|
|
| BLAKE2b-256 |
3d4e1271d75ea678199542e47b0b50fc48740c71ae93ec50ab6f0a3ddcef838d
|