in shims/qpid-proton-python/src/amqp_complex_types_test/Receiver.py [0:0]
def check_arrays_equal(arr1, arr2):
"""Check two Proton arrays are equal"""
# Check params are proton.Array
if not isinstance(arr1, proton.Array) or not isinstance(arr2, proton.Array):
return False
# Check array types are same
if arr1.type != arr2.type:
return False
# Check array sizes are equal
if len(arr1.elements) != len(arr2.elements):
return False
# Check each element is the same value
if len(arr1.elements) > 0:
for elt1, elt2 in zip(arr1.elements, arr2.elements):
if arr1.type == proton.Data.ARRAY and isinstance(elt1, proton.Array):
if not AmqpComplexTypesTestReceiver.check_arrays_equal(elt1, elt2):
return False
elif arr1.type == proton.Data.LIST and isinstance(elt1, list):
if not AmqpComplexTypesTestReceiver.check_lists_equal(elt1, elt2):
return False
elif arr1.type == proton.Data.MAP and isinstance(elt1, dict):
if not AmqpComplexTypesTestReceiver.check_maps_equal(elt1, elt2):
return False
else:
if not AmqpComplexTypesTestReceiver.check_simple_values_equal(elt1, elt2):
return False
return True