From 293a027c8510c0994b2ad095d444c4318b0fe7a4 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Wed, 31 Jul 2019 21:30:59 -0500 Subject: [PATCH] Fix unumpy test to account for new behavior of numpy 1.17 --- uncertainties/unumpy/test_unumpy.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/uncertainties/unumpy/test_unumpy.py b/uncertainties/unumpy/test_unumpy.py index cacb3d9b..5923dfd3 100644 --- a/uncertainties/unumpy/test_unumpy.py +++ b/uncertainties/unumpy/test_unumpy.py @@ -62,8 +62,11 @@ def test_numpy(): # Equivalent with an array of AffineScalarFunc objects: try: numpy.exp(arr + ufloat(0, 0)) - except AttributeError: - pass # ! This is usual (but could be avoided) + except (AttributeError, TypeError): + # In numpy<1.17, an AttributeError is raised in this situation. This was + # considered a bug however, and in numpy 1.17 it was changed to a + # TypeError (see PR #12700 in numpy repository) + pass else: raise Exception("numpy.exp unexpectedly worked")