properties icon indicating copy to clipboard operation
properties copied to clipboard

properties.basic.GettableProperty.equal fail on numpy arrays on modern numpy

Open redhog opened this issue 2 years ago • 0 comments

Comparing elements of numpy arrays of different sizes have long given deprecation warnings, and in modern numpy it fails with an exception. To handle this case, change https://github.com/seequent/properties/blob/dev/properties/basic.py#L264 to:

def equal(self, value_a, value_b):
    try:
        equal = value_a == value_b
    except:
        return False
    if hasattr(equal, '__iter__'):
        return all(equal)
    return equal

redhog avatar Sep 28 '23 14:09 redhog