diff options
author | Julian Taylor <jtaylor.debian@googlemail.com> | 2016-09-01 15:58:09 +0200 |
---|---|---|
committer | Julian Taylor <jtaylor.debian@googlemail.com> | 2016-09-01 16:11:25 +0200 |
commit | d555a0ad0f1191daf8ae83e10933da5556b2510e (patch) | |
tree | cfe1aa43b2e527ee7dd403f6990f4dcf5260cb51 /numpy/core | |
parent | fd298a341ddeb05c471c8dfc16f4cc641d08f8a7 (diff) | |
download | numpy-d555a0ad0f1191daf8ae83e10933da5556b2510e.tar.gz |
TST: fix inplace case of alignment data generator
Due to the lambdas used it didn't actually generate inplace cases.
Fix a few tests that now break due to assuming that the cases are always
out of place.
Also update some numbers to make it more likely to find issues like
loading from wrong array.
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/tests/test_scalarmath.py | 12 | ||||
-rw-r--r-- | numpy/core/tests/test_umath.py | 3 |
2 files changed, 8 insertions, 7 deletions
diff --git a/numpy/core/tests/test_scalarmath.py b/numpy/core/tests/test_scalarmath.py index f9aeb6382..0ae013f12 100644 --- a/numpy/core/tests/test_scalarmath.py +++ b/numpy/core/tests/test_scalarmath.py @@ -73,7 +73,7 @@ class TestBaseMath(TestCase): inp1[...] = np.ones_like(inp1) inp2[...] = np.zeros_like(inp2) assert_almost_equal(np.add(inp1, inp2), exp1, err_msg=msg) - assert_almost_equal(np.add(inp1, 1), exp1 + 1, err_msg=msg) + assert_almost_equal(np.add(inp1, 2), exp1 + 2, err_msg=msg) assert_almost_equal(np.add(1, inp2), exp1, err_msg=msg) np.add(inp1, inp2, out=out) @@ -88,11 +88,11 @@ class TestBaseMath(TestCase): np.divide(1, inp2), err_msg=msg) inp1[...] = np.ones_like(inp1) - inp2[...] = np.zeros_like(inp2) - np.add(inp1, 1, out=out) - assert_almost_equal(out, exp1 + 1, err_msg=msg) - np.add(1, inp2, out=out) - assert_almost_equal(out, exp1, err_msg=msg) + np.add(inp1, 2, out=out) + assert_almost_equal(out, exp1 + 2, err_msg=msg) + inp2[...] = np.ones_like(inp2) + np.add(2, inp2, out=out) + assert_almost_equal(out, exp1 + 2, err_msg=msg) def test_lower_align(self): # check data that is not aligned to element size diff --git a/numpy/core/tests/test_umath.py b/numpy/core/tests/test_umath.py index 759e996e3..db5621279 100644 --- a/numpy/core/tests/test_umath.py +++ b/numpy/core/tests/test_umath.py @@ -1202,8 +1202,9 @@ class TestAbsoluteNegative(TestCase): assert_array_equal(out, d, err_msg=msg) assert_array_equal(-inp, -1*inp, err_msg=msg) + d = -1 * inp np.negative(inp, out=out) - assert_array_equal(out, -1*inp, err_msg=msg) + assert_array_equal(out, d, err_msg=msg) def test_lower_align(self): # check data that is not aligned to element size |