summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_histograms.py
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2018-10-18 18:03:03 -0700
committerGitHub <noreply@github.com>2018-10-18 18:03:03 -0700
commitd209cc912c2204dc09b8780d2572dcb45bd26804 (patch)
tree4a4380f9e4c8cd78361e9785c95795cf771cd9a5 /numpy/lib/tests/test_histograms.py
parent25a37a9c0a9b2cf0de0b221c53da92a8d34e92d5 (diff)
parent9f3ebd486c62785e209ff274894f45854f3570b7 (diff)
downloadnumpy-d209cc912c2204dc09b8780d2572dcb45bd26804.tar.gz
Merge pull request #12217 from tylerjereddy/hist_bin_dims_test
TST: test histogram bins dims
Diffstat (limited to 'numpy/lib/tests/test_histograms.py')
-rw-r--r--numpy/lib/tests/test_histograms.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_histograms.py b/numpy/lib/tests/test_histograms.py
index fa6ad989f..240d05174 100644
--- a/numpy/lib/tests/test_histograms.py
+++ b/numpy/lib/tests/test_histograms.py
@@ -265,6 +265,13 @@ class TestHistogram(object):
hist, edges = np.histogram(arr, bins=30, range=(-0.5, 5))
assert_equal(hist[-1], 1)
+ def test_bin_array_dims(self):
+ # gracefully handle bins object > 1 dimension
+ vals = np.linspace(0.0, 1.0, num=100)
+ bins = np.array([[0, 0.5], [0.6, 1.0]])
+ with assert_raises_regex(ValueError, "must be 1d"):
+ np.histogram(vals, bins=bins)
+
def test_unsigned_monotonicity_check(self):
# Ensures ValueError is raised if bins not increasing monotonically
# when bins contain unsigned values (see #9222)