summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_function_base.py
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2017-09-24 13:21:05 -0700
committerGitHub <noreply@github.com>2017-09-24 13:21:05 -0700
commitbac743beff16d596363e0f7ad4570a7a6bfe7fe5 (patch)
tree04ac749b350725559dc5aace2ea17a53553dc3da /numpy/lib/tests/test_function_base.py
parentc2372aff1ea85e8e1d64d8b5ced7e362fd0f4a5a (diff)
parent1a1db29588055021e4fde133ff0d65b3d881ff3d (diff)
downloadnumpy-bac743beff16d596363e0f7ad4570a7a6bfe7fe5.tar.gz
Merge pull request #9294 from b-carter/fix_histogram_monotonicity_check
BUG: Fixes histogram monotonicity check for unsigned bin values
Diffstat (limited to 'numpy/lib/tests/test_function_base.py')
-rw-r--r--numpy/lib/tests/test_function_base.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py
index c64081088..10440d97c 100644
--- a/numpy/lib/tests/test_function_base.py
+++ b/numpy/lib/tests/test_function_base.py
@@ -1836,6 +1836,14 @@ class TestHistogram(object):
hist, edges = np.histogram(arr, bins=30, range=(-0.5, 5))
assert_equal(hist[-1], 1)
+ def test_unsigned_monotonicity_check(self):
+ # Ensures ValueError is raised if bins not increasing monotonically
+ # when bins contain unsigned values (see #9222)
+ arr = np.array([2])
+ bins = np.array([1, 3, 1], dtype='uint64')
+ with assert_raises(ValueError):
+ hist, edges = np.histogram(arr, bins=bins)
+
class TestHistogramOptimBinNums(object):
"""