mirror of
https://github.com/status-im/status-go.git
synced 2026-08-31 00:51:12 +00:00
tests-functional/ -> test/functional/ tests-unit-network/ -> test/unit-network/ No Go code changes beyond the two package paths. Every reference follows: Makefile targets, the pytest-lint and reliability workflows, the three Jenkinsfiles, the root Dockerfile, pyrightconfig.json, .gitignore, the benchmark and functional-test scripts, and the docs. All paths inside the moved directories are self-contained (docker compose uses `context: .`, the Python helpers resolve from __file__), so the extra level of nesting does not reach outside. refs #7067
21 lines
973 B
Python
21 lines
973 B
Python
def assert_response_attributes(actual, expected, keys=None):
|
|
"""
|
|
Assert that all keys in expected (or in keys) match in actual.
|
|
Handles both list-of-dicts and dict.
|
|
"""
|
|
if isinstance(expected, list):
|
|
assert isinstance(actual, list), "Expected a list for actual"
|
|
assert len(actual) == len(expected), "Length mismatch"
|
|
for idx, exp in enumerate(expected):
|
|
act = actual[idx]
|
|
check_keys = keys or exp.keys()
|
|
for key in check_keys:
|
|
assert act[key] == exp[key], f"Mismatch for key '{key}': {act[key]} != {exp[key]}"
|
|
elif isinstance(expected, dict):
|
|
assert isinstance(actual, dict), "Expected a dict for actual"
|
|
check_keys = keys or expected.keys()
|
|
for key in check_keys:
|
|
assert actual[key] == expected[key], f"Mismatch for key '{key}': {actual.get(key)} != {expected[key]}"
|
|
else:
|
|
raise TypeError("Expected must be a list or dict")
|