From 303cb7266ae63ae52b95af805eb98f1b727fe105 Mon Sep 17 00:00:00 2001 From: Thomas Kluyver <thomas@kluyver.me.uk> Date: Thu, 30 Nov 2023 11:17:31 +0100 Subject: [PATCH] Only use equal_nan=True to compare float datasets --- tests/test_reference_runs/test_pre_deployment.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_reference_runs/test_pre_deployment.py b/tests/test_reference_runs/test_pre_deployment.py index 97c768ef3..ee4bda713 100644 --- a/tests/test_reference_runs/test_pre_deployment.py +++ b/tests/test_reference_runs/test_pre_deployment.py @@ -75,7 +75,9 @@ def validate_file( eq = False # One is an array, the other not elif isinstance(ref_arr, np.ndarray): # Both arrays - eq = np.array_equal(ref_arr, out_arr, equal_nan=True) + nanable = np.issubdtype(ref_arr.dtype, np.floating) \ + or np.issubdtype(ref_arr.dtype, np.complexfloating) + eq = np.array_equal(ref_arr, out_arr, equal_nan=nanable) else: # Both single values eq = ref_arr == out_arr -- GitLab