From 62670df6eb12ade1f0972f3b86ade975bb5bd560 Mon Sep 17 00:00:00 2001 From: Thomas Robitaille Date: Tue, 17 Oct 2023 14:14:13 +0100 Subject: [PATCH] Added full hypothesis test --- fast_histogram/tests/test_histogram.py | 31 ++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/fast_histogram/tests/test_histogram.py b/fast_histogram/tests/test_histogram.py index 42c0c8c..b79dcd9 100644 --- a/fast_histogram/tests/test_histogram.py +++ b/fast_histogram/tests/test_histogram.py @@ -6,6 +6,37 @@ from ..histogram import histogram1d, histogram2d, histogramdd +# First some tests with hypothesis value generation to make sure our +# implementation doesn't crash, and do basic checks of validity of the output. + + +@given( + values=arrays( + dtype="f4", "f8", "= xmin)]) + else: + assert np.sum(fast) == np.sum((x <= xmax) & (x >= xmin)) + + # NOTE: For now we randomly generate values ourselves when comparing to Numpy - # ideally we would make use of hypothesis to do this but when we do this we run # into issues with the numpy implementation too. We have a separate test to