From 2757ccaaf99fa23958e005920014f145be048c8e Mon Sep 17 00:00:00 2001 From: Gerry Manoim Date: Mon, 10 Aug 2020 16:19:30 -0400 Subject: [PATCH] fix code different across numpy versions --- zipline/testing/predicates.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/zipline/testing/predicates.py b/zipline/testing/predicates.py index 2a06de870d..33e006ec96 100644 --- a/zipline/testing/predicates.py +++ b/zipline/testing/predicates.py @@ -577,11 +577,20 @@ def assert_array_equal(result, "expected dtype: %s\n%s" % (result_dtype, expected_dtype, _fmt_path(path)) ) - f = partial( - np.testing.assert_array_compare, - compare_datetime_arrays, - header='Arrays are not equal', - ) + try: + # Depending on the version of numpy testing func is in a different + # place + f = partial( + np.testing.utils.assert_array_compare, + compare_datetime_arrays, + header='Arrays are not equal', + ) + except AttributeError: + f = partial( + np.testing.assert_array_compare, + compare_datetime_arrays, + header='Arrays are not equal', + ) elif array_decimal is not None and expected_dtype.kind not in {'O', 'S'}: f = partial( np.testing.assert_array_almost_equal,