summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_function_base.py
diff options
context:
space:
mode:
authorBrandon Carter <bcarter@mit.edu>2017-06-24 22:59:14 -0400
committerBrandon Carter <bcarter@mit.edu>2017-06-24 22:59:14 -0400
commit23c1db87a939dc2f19cfa3744389e3be667215ba (patch)
treefbeb4f8f7b3acb8b8f348cb9755b6bdaf2413315 /numpy/lib/tests/test_function_base.py
parent518e0744819c189d8f69e51532087add0d203f17 (diff)
downloadnumpy-23c1db87a939dc2f19cfa3744389e3be667215ba.tar.gz
TST: add test for unsigned bins monotonicity check, see #9222
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 4000b55f5..6cd990634 100644
--- a/numpy/lib/tests/test_function_base.py
+++ b/numpy/lib/tests/test_function_base.py
@@ -1771,6 +1771,14 @@ class TestHistogram(TestCase):
hist, edges = np.histogram(arr, bins=30, range=(-0.5, 5))
self.assertEqual(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(TestCase):
"""