summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_histograms.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2017-12-24 11:23:48 -0700
committerGitHub <noreply@github.com>2017-12-24 11:23:48 -0700
commitd45cf0b261b4a563f44fa238d34bd55f051f315f (patch)
tree6ef116d151679c303b9b8fc6cd865b3cf0a5154e /numpy/lib/tests/test_histograms.py
parentb2f3dd3270ae98f20648ab403b5edfc23277223f (diff)
parent99f605c4545597e9a3bdf66f97b98da30f78ae33 (diff)
downloadnumpy-d45cf0b261b4a563f44fa238d34bd55f051f315f.tar.gz
Merge pull request #10268 from eric-wieser/fix-gh-7864
BUG: Fix misleading error when coercing to array
Diffstat (limited to 'numpy/lib/tests/test_histograms.py')
-rw-r--r--numpy/lib/tests/test_histograms.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_histograms.py b/numpy/lib/tests/test_histograms.py
index 59baf91fe..8319041b8 100644
--- a/numpy/lib/tests/test_histograms.py
+++ b/numpy/lib/tests/test_histograms.py
@@ -238,6 +238,17 @@ class TestHistogram(object):
with assert_raises(ValueError):
hist, edges = np.histogram(arr, bins=bins)
+ def test_object_array_of_0d(self):
+ # gh-7864
+ assert_raises(ValueError,
+ histogram, [np.array([0.4]) for i in range(10)] + [-np.inf])
+ assert_raises(ValueError,
+ histogram, [np.array([0.4]) for i in range(10)] + [np.inf])
+
+ # these should not crash
+ np.histogram([np.array([0.5]) for i in range(10)] + [.500000000000001])
+ np.histogram([np.array([0.5]) for i in range(10)] + [.5])
+
class TestHistogramOptimBinNums(object):
"""