Skip to content

Commit 89e25b8

Browse files
committed
ressurect tests
1 parent 96ef816 commit 89e25b8

File tree

2 files changed

+9
-124
lines changed

2 files changed

+9
-124
lines changed

Diff for: tests/test_hist_plot.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def fill_lepton_kinematics():
2222
ak.behavior.update(candidate.behavior)
2323

2424
# histogram creation and manipulation
25-
from coffea import hist
25+
from coffea.jitters import hist
2626

2727
fin = uproot.open("HZZ.root")
2828
tree = fin["events"]
@@ -67,7 +67,7 @@ def test_plot1d():
6767

6868
plt.switch_backend("agg")
6969

70-
from coffea import hist
70+
from coffea.jitters import hist
7171

7272
lepton_kinematics = fill_lepton_kinematics()
7373

@@ -96,7 +96,7 @@ def test_plot2d():
9696
# matplotlib
9797
import matplotlib.pyplot as plt
9898

99-
from coffea import hist
99+
from coffea.jitters import hist
100100

101101
plt.switch_backend("agg")
102102

@@ -115,7 +115,7 @@ def test_plotratio():
115115
# matplotlib
116116
import matplotlib.pyplot as plt
117117

118-
from coffea import hist
118+
from coffea.jitters import hist
119119

120120
plt.switch_backend("agg")
121121

@@ -238,7 +238,7 @@ def test_plotgrid():
238238
# matplotlib
239239
import matplotlib.pyplot as plt
240240

241-
from coffea import hist
241+
from coffea.jitters import hist
242242

243243
plt.switch_backend("agg")
244244

@@ -268,7 +268,7 @@ def test_plotgrid():
268268

269269

270270
def test_clopper_pearson_interval():
271-
from coffea.hist.plot import clopper_pearson_interval
271+
from coffea.jitters.hist.plot import clopper_pearson_interval
272272

273273
# Reference values for CL=0.6800 calculated with ROOT's TEfficiency
274274
num = np.array([1.0, 5.0, 10.0, 10.0])
@@ -293,7 +293,7 @@ def test_clopper_pearson_interval():
293293

294294

295295
def test_normal_interval():
296-
from coffea.hist.plot import normal_interval
296+
from coffea.jitters.hist.plot import normal_interval
297297

298298
# Reference weighted efficiency and error from ROOTs TEfficiency
299299

Diff for: tests/test_hist_tools.py

+2-117
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import sys
2-
31
import awkward as ak
42
import numpy as np
53
import pytest
64
from dummy_distributions import dummy_jagged_eta_pt
75

8-
from coffea import hist
6+
from coffea.jitters import hist
97

108

119
def test_hist():
@@ -217,38 +215,6 @@ def test_hist():
217215
assert h_less.sum("vocalization", "height", "mass", "animal").values()[()] == 1004.0
218216

219217

220-
def test_export1d():
221-
import os
222-
223-
import uproot3
224-
225-
from coffea.hist.export import export1d
226-
227-
counts, test_eta, test_pt = dummy_jagged_eta_pt()
228-
h_regular_bins = hist.Hist("regular_joe", hist.Bin("x", "x", 20, 0, 200))
229-
h_regular_bins.fill(x=test_pt)
230-
231-
hout = export1d(h_regular_bins)
232-
233-
filename = "test_export1d.root"
234-
235-
with uproot3.create(filename) as fout:
236-
fout["regular_joe"] = hout
237-
fout.close()
238-
239-
with uproot3.open(filename) as fin:
240-
hin = fin["regular_joe"]
241-
242-
assert np.all(hin.edges == hout.edges)
243-
assert np.all(hin.values == hout.values)
244-
245-
del hin
246-
del fin
247-
248-
if os.path.exists(filename):
249-
os.remove(filename)
250-
251-
252218
def test_hist_serdes():
253219
import pickle
254220

@@ -291,89 +257,8 @@ def test_hist_serdes_labels():
291257
assert h._axes == hnew._axes
292258

293259

294-
@pytest.mark.skipif(
295-
sys.version_info < (3, 4),
296-
reason="requires python3.4 or higher, test file is pickle proto 4",
297-
)
298-
def test_hist_compat():
299-
from coffea.util import load
300-
301-
test = load("tests/samples/old_hist_format.coffea")
302-
303-
expected_bins = np.array(
304-
[
305-
-np.inf,
306-
0.0,
307-
20.0,
308-
40.0,
309-
60.0,
310-
80.0,
311-
100.0,
312-
120.0,
313-
140.0,
314-
160.0,
315-
180.0,
316-
200.0,
317-
220.0,
318-
240.0,
319-
260.0,
320-
280.0,
321-
300.0,
322-
320.0,
323-
340.0,
324-
360.0,
325-
380.0,
326-
400.0,
327-
420.0,
328-
440.0,
329-
460.0,
330-
480.0,
331-
500.0,
332-
520.0,
333-
540.0,
334-
560.0,
335-
580.0,
336-
600.0,
337-
620.0,
338-
640.0,
339-
660.0,
340-
680.0,
341-
700.0,
342-
720.0,
343-
740.0,
344-
760.0,
345-
780.0,
346-
800.0,
347-
820.0,
348-
840.0,
349-
860.0,
350-
880.0,
351-
900.0,
352-
920.0,
353-
940.0,
354-
960.0,
355-
980.0,
356-
1000.0,
357-
1020.0,
358-
1040.0,
359-
1060.0,
360-
1080.0,
361-
1100.0,
362-
1120.0,
363-
1140.0,
364-
1160.0,
365-
1180.0,
366-
1200.0,
367-
np.inf,
368-
np.nan,
369-
]
370-
)
371-
assert np.all(test._axes[2]._interval_bins[:-1] == expected_bins[:-1])
372-
assert np.isnan(test._axes[2]._interval_bins[-1])
373-
374-
375260
def test_issue_247():
376-
from coffea import hist
261+
from coffea.jitters import hist
377262

378263
h = hist.Hist("stuff", hist.Bin("old", "old", 20, -1, 1))
379264
h.fill(old=h.axis("old").centers())

0 commit comments

Comments
 (0)