From 3511c5ec034ff9cb30e60e57bd19824348bbcbb9 Mon Sep 17 00:00:00 2001 From: cyrraz Date: Thu, 25 Jan 2024 21:08:24 +0100 Subject: [PATCH] add simple test --- tests/test_histogramming.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tests/test_histogramming.py diff --git a/tests/test_histogramming.py b/tests/test_histogramming.py new file mode 100644 index 00000000..064a60b7 --- /dev/null +++ b/tests/test_histogramming.py @@ -0,0 +1,15 @@ +from plothist import make_hist +import boost_histogram as bh + + +def test_make_hist(): + """ + Test make_hist() function. + """ + h = make_hist(data=[0, 1, 2, 3, 4], bins=5, range=(0, 5)) + assert isinstance(h, bh.Histogram) + assert isinstance(h.axes[0], bh.axis.Regular) + assert h.sum().value == 5 + assert h.sum().variance == 5 + assert h[0].value == 1 + assert h[-1].value == 1