summaryrefslogtreecommitdiff
path: root/numpy/lib/tests
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2018-10-18 18:04:32 -0700
committerGitHub <noreply@github.com>2018-10-18 18:04:32 -0700
commiteaffa08deeb1d68ba7e6048ebe1333d617c0a6fa (patch)
treeeb4891f20e14eeff6ce6767359c38d584051c11b /numpy/lib/tests
parentd209cc912c2204dc09b8780d2572dcb45bd26804 (diff)
parente712a4ecaedb9bb10897314dffa2dde01bf1183d (diff)
downloadnumpy-eaffa08deeb1d68ba7e6048ebe1333d617c0a6fa.tar.gz
Merge pull request #12216 from tylerjereddy/hist_range_test_sanity
TST: test invalid histogram range
Diffstat (limited to 'numpy/lib/tests')
-rw-r--r--numpy/lib/tests/test_histograms.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_histograms.py b/numpy/lib/tests/test_histograms.py
index 240d05174..1b5a71d0e 100644
--- a/numpy/lib/tests/test_histograms.py
+++ b/numpy/lib/tests/test_histograms.py
@@ -249,6 +249,12 @@ class TestHistogram(object):
assert_raises(ValueError, histogram, vals, range=[np.nan,0.75])
assert_raises(ValueError, histogram, vals, range=[0.25,np.inf])
+ def test_invalid_range(self):
+ # start of range must be < end of range
+ vals = np.linspace(0.0, 1.0, num=100)
+ with assert_raises_regex(ValueError, "max must be larger than"):
+ np.histogram(vals, range=[0.1, 0.01])
+
def test_bin_edge_cases(self):
# Ensure that floating-point computations correctly place edge cases.
arr = np.array([337, 404, 739, 806, 1007, 1811, 2012])