No project description provided
Project description
Compare For Testing Overview
Installation
Install from PyPi:
pip install compare-for-testing
Importing
from compare_for_testing import compare # For compare of 2 objects
Example
json_1 = {
'a': 1,
'b': 2,
'empty': '',
}
json_2 = {
'aa': True,
'b': 4,
'empty': '!empty',
'empty_failed': '!empty',
}
result = compare(json_2, json_1)
{
'aa': {'Хотели': True, 'Получили': "Поля 'aa' нет в ответе"},
'b': {'Хотели': 4, 'Получили': 2},
'empty_failed': {'Хотели': '!empty', 'Получили': "Поля 'empty_failed' нет в ответе"}
}
json_1 = {
'c': [
{
'sub_a': 1,
'sub_b': 3
},
{
'sub_a': 2,
'sub_b': 4
},
{
'sub_a': 3,
'sub_b': 5,
'sub_c': {
'name': 'test',
'id': 5,
}
},
],
}
json_2 = {
'c': [
{
'sub_a': 11,
'sub_b': 43
},
{
'sub_a': 21,
'sub_b': 4
},
{
'sub_a': '!not_empty',
'sub_b': '!empty',
'sub_c': {
'name': 'test',
'name2': 'test',
}
},
{
'sub_a': '!not_empty',
'sub_b': 8,
'sub_c': {
'name': 'test',
}
},
],
}
result = compare(json_2, json_1)
{
'c': {
0: {
'sub_a': {'Хотели': 11, 'Получили': 1},
'sub_b': {'Хотели': 43, 'Получили': 3}
},
1: {
'sub_a': {'Хотели': 21, 'Получили': 2}
},
2: {
'sub_b': {'Хотели': '!empty', 'Получили': 5},
'sub_c': {
'name2': {'Хотели': 'test', 'Получили': "Поля 'name2' нет в ответе"}
}
},
3: {
'Хотели': {'sub_a': '!not_empty', 'sub_b': 8, 'sub_c': {'name': 'test'}},
'Получили': None
}
}
}
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
Built Distribution
Close
Hashes for compare_for_testing-1.1.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3398fee456612f7ebf2d76009b81dcb4495b888d8f45e6a3d4bb205ce92ac221 |
|
MD5 | 90b66d12d66b48112ac2fb309e2093cf |
|
BLAKE2b-256 | 3d4a5eff5a6d0a0f7cd9bf0f878f9a65335fd9876f14f656ccd45daa220d1b15 |
Close
Hashes for compare_for_testing-1.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90fcaa8d181d915f9eceb1ecee7b7bab0e8108c892dafb193769aba8a0f8bc5b |
|
MD5 | 19b54220f8e0cb6c7c6558f66b58ffa9 |
|
BLAKE2b-256 | 92804ac23cb3f8a5054fc054c5c7d6b31ec97d4ffb7daf6d744a2a006ec97e96 |