20import generators
as ge
24from validationplots
import get_metadata
40 """ This test tests the ValidationMetadataSetter module via its interface
41 :func:`validation_tools.metadata.create_validation_histograms`
45 """ Open temporary directory to work in. """
47 self.
tmp_dir = tempfile.TemporaryDirectory()
50 """ Clean up temporary directory """
55 tmp_dir_path = pathlib.Path(self.
tmp_dir.name)
57 dec_path = tmp_dir_path /
"test_y4s_trivial.dec"
58 with dec_path.open(
"w")
as decfile:
59 decfile.write(TRIVIAL_DECFILE)
64 path = basf2.create_path()
66 ge.add_evtgen_generator(
69 signaldecfile=basf2.find_file(str(dec_path)),
74 out_file_path = tmp_dir_path /
"out.root"
75 create_validation_histograms(
86 "me <wontreply@dont.try>",
103 "me <wontreply@dont.try>",
104 "some description nobody reads",
111 description=
"Overall description of plots in this package.",
114 basf2.process(path=path)
119 tf = ROOT.TFile(str(out_file_path))
124 d = tf.Get(
"Description")
126 d.GetTitle(),
"Overall description of plots in this package."
132 md = get_metadata(tf.Get(
"M"))
133 self.assertEqual(md[
"description"],
"description of M")
134 self.assertEqual(md[
"check"],
"nothing to check")
135 self.assertEqual(md[
"metaoptions"], [])
136 self.assertEqual(md[
"contact"],
"me <wontreply@dont.try>")
141 md = get_metadata(tf.Get(
"MM"))
142 self.assertEqual(md[
"description"],
"some description nobody reads")
143 self.assertEqual(md[
"check"],
"nothing to check")
144 self.assertEqual(md[
"metaoptions"], [
"mop1",
"mop2"])
145 self.assertEqual(md[
"contact"],
"me <wontreply@dont.try>")
148if __name__ ==
"__main__":
def setupEventInfo(noEvents, path)
def fillParticleListFromMC(decayString, cut, addDaughters=False, skipNonPrimaryDaughters=False, writeOut=False, path=None, skipNonPrimary=False, skipInitial=True)