Skip to content

Commit

Permalink
use real version; testing cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasdavis committed Dec 5, 2022
1 parent 5336610 commit 84ca5b5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 18 deletions.
13 changes: 8 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ build-backend = "scikit_build_core.build"

[project]
name = "pygram11"
version = "0.999"
version = "0.13.2"
readme = "README.md"
description = "Fast histogramming in Python built on pybind11 and OpenMP."
authors = [
Expand All @@ -28,10 +28,13 @@ dependencies = ["numpy"]

[tool.pytest.ini_options]
norecursedirs = ["extern"]
markers = [
"misci: Miscellaneous",
"OD: One dimensional histograms",
"TD: Two dimensional histograms",
testpaths = ["tests"]
addopts = [
"-v",
"-ra",
"--showlocals",
"--strict-markers",
"--strict-config",
]

[tool.cibuildwheel]
Expand Down
2 changes: 1 addition & 1 deletion src/pygram11/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"""

__version__ = "0.999"
__version__ = "0.13.2"

from ._hist import ( # noqa
bin_centers,
Expand Down
12 changes: 0 additions & 12 deletions tests/test_hist.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ def make_data_mw(self, xtype, wtype):
@pytest.mark.parametrize("flow", [True, False])
@pytest.mark.parametrize("func", [pg.histogram, pg.fix1d])
@pytest.mark.parametrize("cons_var", [True, False])
@pytest.mark.OD
def test_no_weight_and_single_weight(
self, xtype, wtype, density, flow, func, cons_var
):
Expand Down Expand Up @@ -89,7 +88,6 @@ def test_no_weight_and_single_weight(
@pytest.mark.parametrize("wtype", [np.float32, np.float64])
@pytest.mark.parametrize("flow", [True, False])
@pytest.mark.parametrize("func", [pg.histogram, pg.fix1dmw])
@pytest.mark.OD
def test_multiple_weights(self, xtype, wtype, flow, func):
x, w = self.make_data_mw(xtype, wtype)
n, xmin, xmax = 50, -10.1, 10.1
Expand All @@ -114,7 +112,6 @@ def test_multiple_weights(self, xtype, wtype, flow, func):
res1[-1] += np.sum(w[:, i][x >= xmax])
npt.assert_allclose(res0a[:, i], res1, atol=0.01, rtol=1.0e-3)

@pytest.mark.OD
@pg.without_omp
def test_cons_var_nomp(self):
x = RNG.standard_normal(size=(500,))
Expand All @@ -124,7 +121,6 @@ def test_cons_var_nomp(self):
npt.assert_allclose(res1, res2)
npt.assert_allclose(var1, res1 * 0.5)

@pytest.mark.OD
@pg.with_omp
def test_cons_var_womp(self):
x = RNG.standard_normal(size=(500,))
Expand Down Expand Up @@ -164,7 +160,6 @@ def make_data_mw(self, xtype, wtype):
@pytest.mark.parametrize("density", [True, False])
@pytest.mark.parametrize("flow", [True, False])
@pytest.mark.parametrize("func", [pg.histogram, pg.var1d])
@pytest.mark.OD
def test_no_weight_and_single_weight(self, xtype, wtype, bins, density, flow, func):
if density and flow:
assert True
Expand Down Expand Up @@ -192,7 +187,6 @@ def test_no_weight_and_single_weight(self, xtype, wtype, bins, density, flow, fu
@pytest.mark.parametrize("bins", [E1, E2])
@pytest.mark.parametrize("flow", [True, False])
@pytest.mark.parametrize("func", [pg.var1dmw, pg.histogram])
@pytest.mark.OD
def test_multiple_weights(self, xtype, wtype, bins, flow, func):
x, w = self.make_data_mw(xtype, wtype)
xmin, xmax = bins[0], bins[-1]
Expand Down Expand Up @@ -221,7 +215,6 @@ def make_data(self, xtype, ytype, wtype):
@pytest.mark.parametrize("wtype", [None, np.float64, np.float32])
@pytest.mark.parametrize("flow", [False])
@pytest.mark.parametrize("func", [pg.histogram2d, pg.fix2d])
@pytest.mark.TD
def test_no_weight_and_single_weight(self, xtype, ytype, wtype, flow, func):
x, y, w = self.make_data(xtype, ytype, wtype)
nbx, xmin, xmax = 25, -10.1, 10.1
Expand Down Expand Up @@ -276,7 +269,6 @@ def make_data(self, xtype, ytype, wtype):
@pytest.mark.parametrize("ybins", [E1, E2])
@pytest.mark.parametrize("flow", [False])
@pytest.mark.parametrize("func", [pg.var2d, pg.histogram2d])
@pytest.mark.TD
def test_no_weight_and_single_weight(
self, xtype, ytype, wtype, xbins, ybins, flow, func
):
Expand Down Expand Up @@ -306,7 +298,6 @@ class TestExceptions:
W2 = np.abs(RNG.standard_normal(size=(50, 3)))

@pytest.mark.parametrize("xtype", BAD_TYPES)
@pytest.mark.misci
def test_f1d(self, xtype):
x = self.X.astype(xtype)
w1 = self.W1
Expand All @@ -328,7 +319,6 @@ def test_f1d(self, xtype):
pg.fix1dmw(x, weights=w2)

@pytest.mark.parametrize("xtype", BAD_TYPES)
@pytest.mark.misci
def test_v1d(self, xtype):
x = self.X.astype(xtype)
# bad range
Expand All @@ -337,7 +327,6 @@ def test_v1d(self, xtype):


class TestConvenience:
@pytest.mark.misci
def test_bin_centers(self):
edges = [1, 2, 3, 4, 5, 6]
c = pg.bin_centers(edges)
Expand All @@ -350,7 +339,6 @@ def test_bin_centers(self):
c2 = np.array([2.0, 3.5, 6.0, 8.5, 9.1])
npt.assert_allclose(c, c2)

@pytest.mark.misci
def test_bin_edges(self):
edges = pg.bin_edges(8, (-4, 4))
e2 = np.array([-4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0])
Expand Down

0 comments on commit 84ca5b5

Please sign in to comment.