40 """Check if the parameters of a module are set explicitly to a given value
42 module: basf2.Module instance
43 params: named parameters of to check for
45 for p
in module.available_params():
47 self.assertTrue(p.setInSteering)
48 self.assertEqual(p.values, params[p.name])
90 def test_condition(self):
91 """check that modules in a condition sub path are not affected by default"""
92 self.m2.if_true(self.subpath)
93 basf2.set_module_parameters(self.path, "evt1", evtNumList=[1, 2, 3])
94 self.check_parameters(self.m1, evtNumList=[1, 2, 3])
95 self.check_unset(self.m2)
96 self.check_unset(self.m3)
98 def test_condition_recursive(self):
99 """check that modules in a condition sub path are affected in recursive mode"""
100 self.m2.if_true(self.subpath)
101 basf2.set_module_parameters(self.path, "evt1", evtNumList=[1, 2, 3], recursive=True)
102 self.check_parameters(self.m1, evtNumList=[1, 2, 3])
103 self.check_unset(self.m2)
104 self.check_parameters(self.m3, evtNumList=[1, 2, 3])
106 def test_subevent(self):
107 """check that modules in a for_each sub path are not affected by default"""
108 self.path.for_each("foo", "foos", self.subpath)
109 basf2.set_module_parameters(self.path, "evt1", evtNumList=[1, 2, 3])
110 self.check_parameters(self.m1, evtNumList=[1, 2, 3])
111 self.check_unset(self.m2)
112 self.check_unset(self.m3)
114 def test_subevent_recursive(self):
115 """check that modules in a for_each sub path are affected in recursive mode"""
116 self.path.for_each("foo", "foos", self.subpath)
117 basf2.set_module_parameters(self.path, "evt1", evtNumList=[1, 2, 3], recursive=True)
118 self.check_parameters(self.m1, evtNumList=[1, 2, 3])
119 self.check_unset(self.m2)
120 self.check_parameters(self.m3, evtNumList=[1, 2, 3])
122 def test_condition_subevent(self):
123 """check that it also works with a conditions and a for_each sub path in recursive mode"""
124 sub2 = basf2.create_path()
125 m4 = sub2.add_module("EventInfoSetter")
127 self.m2.if_true(self.subpath)
128 self.path.for_each("foo", "foos", sub2)
129 basf2.set_module_parameters(self.path, "evt1", evtNumList=[1, 2, 3], recursive=True)
130 self.check_parameters(self.m1, evtNumList=[1, 2, 3])
131 self.check_unset(self.m2)
132 self.check_parameters(self.m3, evtNumList=[1, 2, 3])
133 self.check_parameters(m4, evtNumList=[1, 2, 3])