9 testFile = tempfile.NamedTemporaryFile()
10 fileName = testFile.name
12 rootfile = ROOT.TFile.Open(fileName,
'RECREATE')
13 hist = ROOT.TH1F(
'hist',
'TextHistogram', 100, 0, 1)
14 ROOT.gRandom.SetSeed(42)
16 hist.Fill(ROOT.gRandom.Uniform())
18 oldHist = hist.Clone()
19 oldHist.SetDirectory(0)
22 subprocess.run([
'b2file-normalize',
'-i',
'-n',
'NormalizedRootFile',
'-r',
'61408', fileName], check=
True)
24 newRootFile = ROOT.TFile.Open(fileName)
25 newHist = newRootFile.Get(
'hist')
26 assert 0 == newHist.Chi2Test(oldHist,
'PCHI2')
29 checksum = hashlib.md5()
30 checksum.update(open(fileName,
'rb').read())
31 print(checksum.digest().hex())
32 assert checksum.digest().hex() ==
'4b616ad813c35498f6f8aa09f2bcebda'