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