diff options
author | Jaime <jaime.frio@gmail.com> | 2015-07-27 21:12:17 -0700 |
---|---|---|
committer | Jaime <jaime.frio@gmail.com> | 2015-07-27 21:12:17 -0700 |
commit | a92c4a108bd9b2b14f306534ad3105ed76485572 (patch) | |
tree | ea07d40904f1309d7a8a34de3caac09d48be0dcf /numpy/lib/tests/test_function_base.py | |
parent | 9232200cb99323730d5ad23c79a846649b55a345 (diff) | |
parent | c49821c55b45574cd7d5300ddd4a83f12fcaa7e0 (diff) | |
download | numpy-a92c4a108bd9b2b14f306534ad3105ed76485572.tar.gz |
Merge pull request #6126 from astrofrog/fix-histogram-regression
BUG: fixed regression in np.histogram which caused input floating-point values to be modified
Diffstat (limited to 'numpy/lib/tests/test_function_base.py')
-rw-r--r-- | numpy/lib/tests/test_function_base.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index a82fab6a7..b29012bcb 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -1221,6 +1221,13 @@ class TestHistogram(TestCase): wa, wb = histogram(values, bins=2, range=[1, 3], weights=weights) assert_array_almost_equal(wa, [Decimal(1), Decimal(5)]) + def test_no_side_effects(self): + # This is a regression test that ensures that values passed to + # ``histogram`` are unchanged. + values = np.array([1.3, 2.5, 2.3]) + np.histogram(values, range=[-10, 10], bins=100) + assert_array_almost_equal(values, [1.3, 2.5, 2.3]) + def test_empty(self): a, b = histogram([], bins=([0, 1])) assert_array_equal(a, np.array([0])) |