From 23c1db87a939dc2f19cfa3744389e3be667215ba Mon Sep 17 00:00:00 2001 From: Brandon Carter Date: Sat, 24 Jun 2017 22:59:14 -0400 Subject: TST: add test for unsigned bins monotonicity check, see #9222 --- numpy/lib/tests/test_function_base.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'numpy/lib/tests') 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): """ -- cgit v1.2.1