From 58e9e27c0c110f9be1558a53fb547dc1abc76fa4 Mon Sep 17 00:00:00 2001 From: Sebastian Berg Date: Thu, 5 Dec 2013 22:53:26 +0100 Subject: DEP: Deprecate boolean `-` operations Boolean - is not well defined, especially the unary and binary operator are not compatible. In general boolean minus seems to have no real application and does not do what might be expected. All "allclose" type functions (numpy, tests, masked) have to now check for boolean to avoid the deprecation warning. In the future one could think about removing it again and just allowing the upcast. --- numpy/testing/utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'numpy/testing/utils.py') diff --git a/numpy/testing/utils.py b/numpy/testing/utils.py index 2a99fe5cb..82aa1e39c 100644 --- a/numpy/testing/utils.py +++ b/numpy/testing/utils.py @@ -810,7 +810,12 @@ def assert_array_almost_equal(x, y, decimal=6, err_msg='', verbose=True): y = y[~yinfid] except (TypeError, NotImplementedError): pass - z = abs(x-y) + + if x.dtype.kind == 'b' and y.dtype.kind == 'b': + z = x ^ y + else: + z = abs(x-y) + if not issubdtype(z.dtype, number): z = z.astype(float_) # handle object arrays return around(z, decimal) <= 10.0**(-decimal) -- cgit v1.2.1