diff options
Diffstat (limited to 'numpy/lib/tests/test_histograms.py')
-rw-r--r-- | numpy/lib/tests/test_histograms.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/numpy/lib/tests/test_histograms.py b/numpy/lib/tests/test_histograms.py index a2c684a20..4f7af214c 100644 --- a/numpy/lib/tests/test_histograms.py +++ b/numpy/lib/tests/test_histograms.py @@ -2,7 +2,7 @@ from __future__ import division, absolute_import, print_function import numpy as np -from numpy.lib.histograms import histogram, histogramdd +from numpy.lib.histograms import histogram, histogramdd, histogram_bin_edges from numpy.testing import ( run_module_suite, assert_, assert_equal, assert_array_equal, assert_almost_equal, assert_array_almost_equal, assert_raises, @@ -346,6 +346,20 @@ class TestHistogram(object): self.do_precision(np.single, np.longdouble) self.do_precision(np.double, np.longdouble) + def test_histogram_bin_edges(self): + hist, e = histogram([1, 2, 3, 4], [1, 2]) + edges = histogram_bin_edges([1, 2, 3, 4], [1, 2]) + assert_array_equal(edges, e) + + arr = np.array([0., 0., 0., 1., 2., 3., 3., 4., 5.]) + hist, e = histogram(arr, bins=30, range=(-0.5, 5)) + edges = histogram_bin_edges(arr, bins=30, range=(-0.5, 5)) + assert_array_equal(edges, e) + + hist, e = histogram(arr, bins='auto', range=(0, 1)) + edges = histogram_bin_edges(arr, bins='auto', range=(0, 1)) + assert_array_equal(edges, e) + class TestHistogramOptimBinNums(object): """ |