16testFile = tempfile.NamedTemporaryFile()
17fileName = testFile.name
19rootfile = ROOT.TFile.Open(fileName,
'RECREATE')
20hist = ROOT.TH1F(
'hist',
'TextHistogram', 100, 0, 1)
21ROOT.gRandom.SetSeed(42)
23 hist.Fill(ROOT.gRandom.Uniform())
26oldHist.SetDirectory(0)
29subprocess.run([
'b2file-normalize',
'-i',
'-n',
'NormalizedRootFile',
'-r',
'61408', fileName], check=
True)
31newRootFile = ROOT.TFile.Open(fileName)
32newHist = newRootFile.Get(
'hist')
33assert 0 == newHist.Chi2Test(oldHist,
'PCHI2')
36checksum = hashlib.md5()
37checksum.update(open(fileName,
'rb').read())
38print(checksum.digest().hex())
39assert checksum.digest().hex() ==
'ddef04f82a39be019daf7c83d2f5005c'