AttributeEqualityComparison.comparison_dictionary

giant.utilities.mixin_classes.attribute_equality_comparison:

AttributeEqualityComparison.comparison_dictionary(other)[source]

Compares each attribute of self to other and stores the result in a dict mapping the attribute to the comparison result.

Each attribute is compared with a call to the internal _value_comparison() which by default uses numpy’s allclose functionality for arraylike objects and standard equality checks for all others. Therefore, if more detailed handling is needed, this _value_comparison() method can be overridden while maintaining the functionality in this method and the class’s equality comparison check.

This assumes that other and self are the same type and have the same attributes.

Parameters:

other (Self) – The other instance to compare with

Returns:

A dictionary mapping attribute names to comparison results

Return type:

dict[str, bool]