11 import modularAnalysis
12 import generators
as ge
16 from validationplots
import get_metadata
32 """ This test tests the ValidationMetadataSetter module via its interface
33 :func:`validation_tools.metadata.create_validation_histograms`
36 """ Open temporary directory to work in. """
38 self.
tmp_dir = tempfile.TemporaryDirectory()
41 """ Clean up temporary directory """
46 tmp_dir_path = pathlib.Path(self.
tmp_dir.name)
48 dec_path = tmp_dir_path /
"test_y4s_trivial.dec"
49 with dec_path.open(
"w")
as decfile:
50 decfile.write(TRIVIAL_DECFILE)
55 path = basf2.create_path()
57 ge.add_evtgen_generator(
60 signaldecfile=basf2.find_file(str(dec_path))
67 out_file_path = tmp_dir_path /
"out.root"
68 create_validation_histograms(
74 "M", 100, 5, 15,
"mass",
"me <wontreply@dont.try>",
75 "description of M",
"nothing to check",
81 "M", 100, 5, 15,
"M", 100, 5, 15,
"mass vs mass",
82 "me <wontreply@dont.try>",
"some description nobody reads",
83 "nothing to check",
"x label",
"why label?",
"mop1, mop2"
86 description=
"Overall description of plots in this package."
94 tf = ROOT.TFile(str(out_file_path))
99 d = tf.Get(
"Description")
102 "Overall description of plots in this package."
108 md = get_metadata(tf.Get(
"M"))
109 self.assertEqual(md[
"description"],
"description of M")
110 self.assertEqual(md[
"check"],
"nothing to check")
111 self.assertEqual(md[
"metaoptions"], [])
112 self.assertEqual(md[
"contact"],
"me <wontreply@dont.try>")
117 md = get_metadata(tf.Get(
"MM"))
118 self.assertEqual(md[
"description"],
"some description nobody reads")
119 self.assertEqual(md[
"check"],
"nothing to check")
120 self.assertEqual(md[
"metaoptions"], [
"mop1",
"mop2"])
121 self.assertEqual(md[
"contact"],
"me <wontreply@dont.try>")
124 if __name__ ==
"__main__":