diff options
author | Sebastian Berg <sebastian@sipsolutions.net> | 2013-12-05 22:53:26 +0100 |
---|---|---|
committer | Sebastian Berg <sebastian@sipsolutions.net> | 2014-02-12 13:50:34 +0100 |
commit | 58e9e27c0c110f9be1558a53fb547dc1abc76fa4 (patch) | |
tree | 79f5937059690e0d9188a9bada96f03a1661402b /numpy/testing/utils.py | |
parent | f57c77b88a735d5f49a407881777ff2e9f3b1be2 (diff) | |
download | numpy-58e9e27c0c110f9be1558a53fb547dc1abc76fa4.tar.gz |
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.
Diffstat (limited to 'numpy/testing/utils.py')
-rw-r--r-- | numpy/testing/utils.py | 7 |
1 files changed, 6 insertions, 1 deletions
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) |