Skip to content

Commit 50a7b52

Browse files
henryiiiHDembinski
authored andcommitted
All test storages use ()
1 parent 8721d04 commit 50a7b52

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

tests/test_histogram_internal.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def test_1D_fill_int(storage):
2525

2626
vals = (0.15, 0.25, 0.25)
2727

28-
hist = bh.Histogram(bh.axis.Regular(bins, *ranges), storage=storage)
28+
hist = bh.Histogram(bh.axis.Regular(bins, *ranges), storage=storage())
2929
assert hist._storage_type == storage
3030
hist.fill(vals)
3131

@@ -49,7 +49,7 @@ def test_2D_fill_int(storage):
4949
hist = bh.Histogram(
5050
bh.axis.Regular(bins[0], *ranges[0]),
5151
bh.axis.Regular(bins[1], *ranges[1]),
52-
storage=storage,
52+
storage=storage(),
5353
)
5454
assert hist._storage_type == storage
5555
hist.fill(*vals)
@@ -69,7 +69,7 @@ def test_2D_fill_int(storage):
6969

7070
def test_edges_histogram():
7171
edges = (1, 12, 22, 79)
72-
hist = bh.Histogram(bh.axis.Variable(edges), storage=bh.storage.Int)
72+
hist = bh.Histogram(bh.axis.Variable(edges), storage=bh.storage.Int())
7373

7474
vals = (13, 15, 24, 29)
7575
hist.fill(vals)
@@ -81,7 +81,7 @@ def test_edges_histogram():
8181

8282

8383
def test_int_histogram():
84-
hist = bh.Histogram(bh.axis.Integer(3, 7), storage=bh.storage.Int)
84+
hist = bh.Histogram(bh.axis.Integer(3, 7), storage=bh.storage.Int())
8585

8686
vals = (1, 2, 3, 4, 5, 6, 7, 8, 9)
8787
hist.fill(vals)
@@ -93,14 +93,16 @@ def test_int_histogram():
9393

9494

9595
def test_str_categories_histogram():
96-
hist = bh.Histogram(bh.axis.Category(["a", "b", "c"]), storage=bh.storage.Int)
96+
hist = bh.Histogram(bh.axis.Category(["a", "b", "c"]), storage=bh.storage.Int())
9797

9898
vals = ["a", "b", "b", "c"]
9999
# Can't fill yet
100100

101101

102102
def test_growing_histogram():
103-
hist = bh.Histogram(bh.axis.Regular(10, 0, 1, growth=True), storage=bh.storage.Int)
103+
hist = bh.Histogram(
104+
bh.axis.Regular(10, 0, 1, growth=True), storage=bh.storage.Int()
105+
)
104106

105107
hist.fill(1.45)
106108

@@ -109,7 +111,7 @@ def test_growing_histogram():
109111

110112
def test_numpy_flow():
111113
h = bh.Histogram(
112-
bh.axis.Regular(10, 0, 1), bh.axis.Regular(5, 0, 1), storage=bh.storage.Int
114+
bh.axis.Regular(10, 0, 1), bh.axis.Regular(5, 0, 1), storage=bh.storage.Int()
113115
)
114116

115117
for i in range(10):
@@ -133,7 +135,7 @@ def test_numpy_flow():
133135

134136
def test_numpy_compare():
135137
h = bh.Histogram(
136-
bh.axis.Regular(10, 0, 1), bh.axis.Regular(5, 0, 1), storage=bh.storage.Int
138+
bh.axis.Regular(10, 0, 1), bh.axis.Regular(5, 0, 1), storage=bh.storage.Int()
137139
)
138140

139141
xs = []
@@ -158,10 +160,10 @@ def test_numpy_compare():
158160

159161
def test_project():
160162
h = bh.Histogram(
161-
bh.axis.Regular(10, 0, 1), bh.axis.Regular(5, 0, 1), storage=bh.storage.Int
163+
bh.axis.Regular(10, 0, 1), bh.axis.Regular(5, 0, 1), storage=bh.storage.Int()
162164
)
163-
h0 = bh.Histogram(bh.axis.Regular(10, 0, 1), storage=bh.storage.Int)
164-
h1 = bh.Histogram(bh.axis.Regular(5, 0, 1), storage=bh.storage.Int)
165+
h0 = bh.Histogram(bh.axis.Regular(10, 0, 1), storage=bh.storage.Int())
166+
h1 = bh.Histogram(bh.axis.Regular(5, 0, 1), storage=bh.storage.Int())
165167

166168
for x, y in (
167169
(0.3, 0.3),
@@ -193,7 +195,7 @@ def test_sums():
193195

194196

195197
def test_int_cat_hist():
196-
h = bh.Histogram(bh.axis.Category([1, 2, 3]), storage=bh.storage.Int)
198+
h = bh.Histogram(bh.axis.Category([1, 2, 3]), storage=bh.storage.Int())
197199

198200
h.fill(1)
199201
h.fill(2)

tests/test_profiles.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
def test_mean_hist():
66

7-
h = bh.Histogram(bh.axis.Regular(3, 0, 1), storage=bh.storage.Mean)
7+
h = bh.Histogram(bh.axis.Regular(3, 0, 1), storage=bh.storage.Mean())
88

99
h.fill(0.10, sample=[2.5])
1010
h.fill(0.25, sample=[3.5])

tests/test_public_hist.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def test_fill_1d(flow):
139139
# TODO: atomic_int not supported
140140
@pytest.mark.parametrize("storage", [bh.storage.Int, bh.storage.Double])
141141
def test_setting(storage):
142-
h = bh.Histogram(bh.axis.Regular(10, 0, 1), storage=storage)
142+
h = bh.Histogram(bh.axis.Regular(10, 0, 1), storage=storage())
143143
h[bh.underflow] = 1
144144
h[0] = 2
145145
h[1] = 3
@@ -560,12 +560,11 @@ def test_numpy_conversion_2():
560560

561561

562562
def test_numpy_conversion_3():
563-
# It's okay to forget the () on a storage
564563
a = bh.Histogram(
565564
bh.axis.Integer(0, 2),
566565
bh.axis.Integer(0, 3),
567566
bh.axis.Integer(0, 4),
568-
storage=bh.storage.Double,
567+
storage=bh.storage.Double(),
569568
)
570569

571570
r = np.zeros((4, 5, 6))

0 commit comments

Comments
 (0)