fixup array equality checking in the case where _USE_NUMPY is false but we somehow still get an ndarray

mostly happens during testing
This commit is contained in:
Jan Petykiewicz 2020-05-19 00:49:42 -07:00
parent 55638fcde5
commit aaef122178

View File

@ -2649,10 +2649,13 @@ def dedup_field(record, r_field: str, modals: Modals, m_field: str):
r = getattr(record, r_field) r = getattr(record, r_field)
m = getattr(modals, m_field) m = getattr(modals, m_field)
if r is not None: if r is not None:
if _USE_NUMPY and m_field in ('polygon_point_list', 'path_point_list'): if m_field in ('polygon_point_list', 'path_point_list'):
equal = numpy.array_equal(m, r) if _USE_NUMPY:
equal = numpy.array_equal(m, r)
else:
equal = (m is not None) and all(tuple(mm) == tuple(rr) for mm, rr in zip(m, r))
else: else:
equal = m is not None and m == r equal = (m is not None) and m == r
if equal: if equal:
setattr(record, r_field, None) setattr(record, r_field, None)