From aaef1221781f8bb2f52c84c56a0533d31062e484 Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Tue, 19 May 2020 00:49:42 -0700 Subject: [PATCH] fixup array equality checking in the case where _USE_NUMPY is false but we somehow still get an ndarray mostly happens during testing --- fatamorgana/records.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fatamorgana/records.py b/fatamorgana/records.py index c8e2d9b..8d6db53 100644 --- a/fatamorgana/records.py +++ b/fatamorgana/records.py @@ -2649,10 +2649,13 @@ def dedup_field(record, r_field: str, modals: Modals, m_field: str): r = getattr(record, r_field) m = getattr(modals, m_field) if r is not None: - if _USE_NUMPY and m_field in ('polygon_point_list', 'path_point_list'): - equal = numpy.array_equal(m, r) + if m_field in ('polygon_point_list', 'path_point_list'): + 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: - equal = m is not None and m == r + equal = (m is not None) and m == r if equal: setattr(record, r_field, None)