def test_histogram_range(bin_type, N=1000, rseed=0): # Regression test for #8010 rng = np.random.RandomState(rseed) x = rng.randn(N) range = (0.1, 0.8) bins = calculate_bin_edges(x, bin_type, range=range) assert bins.max() == range[1] assert bins.min() == range[0]
def test_histogram_range_with_bins_list(N=1000, rseed=0): # The expected result when the input bins is a list is # the same list on output. rng = np.random.RandomState(rseed) x = rng.randn(N) range = (0.1, 0.8) input_bins = np.linspace(-5, 5, 31) bins = calculate_bin_edges(x, input_bins, range=range) assert all(bins == input_bins)
def test_histogram_range(bin_type, N=1000, rseed=0): # Regression test for #8010 rng = np.random.RandomState(rseed) x = rng.randn(N) range = (0.1, 0.8) # Warning is emitted for blocks with warnings.catch_warnings(): warnings.filterwarnings('ignore', message=r'.*p0 does not seem to accurate.*', category=AstropyUserWarning) bins = calculate_bin_edges(x, bin_type, range=range) assert bins.max() == range[1] assert bins.min() == range[0]