in src/rpdk/core/contract/resource_client.py [0:0]
def compare(self, inputs, outputs, path=()):
assertion_error_message = (
"All properties specified in the request MUST "
"be present in the model returned, and they MUST"
" match exactly, with the exception of properties"
" defined as writeOnlyProperties in the resource schema"
)
try:
if isinstance(inputs, dict):
for key in inputs:
new_path = path + (key,)
if isinstance(inputs[key], dict):
self.compare(inputs[key], outputs[key], new_path)
elif isinstance(inputs[key], list):
assert len(inputs[key]) == len(outputs[key])
is_ordered = traverse_raw_schema(self._schema, new_path).get(
"insertionOrder", True
)
self.compare_collection(
inputs[key], outputs[key], is_ordered, new_path
)
else:
assert inputs[key] == outputs[key], assertion_error_message
else:
assert inputs == outputs, assertion_error_message
except Exception as exception:
raise AssertionError(assertion_error_message) from exception