13 class ReturnTrueFalse(basf2.Module):
18 self.event_counter = 0
21 self.return_value(int(self.event_counter % 3))
22 self.event_counter += 1
25 class Counter(basf2.Module):
39 counter_end = Counter()
41 counter_path_0 = basf2.create_path()
42 counter_path_0.add_module(counter_0)
43 counter_path_1 = basf2.create_path()
44 counter_path_1.add_module(counter_1)
45 counter_path_2 = basf2.create_path()
46 counter_path_2.add_module(counter_2)
48 path = basf2.create_path()
49 path.add_module(
"EventInfoSetter", evtNumList=[3])
51 module_with_conditions = path.add_module(ReturnTrueFalse())
52 module_with_conditions.if_value(
"=0", counter_path_0)
53 module_with_conditions.if_value(
"=1", counter_path_1)
54 module_with_conditions.if_value(
"=2", counter_path_2, basf2.AfterConditionPath.CONTINUE)
56 path.add_module(counter_end)
60 assert counter_0.counter == 1
61 assert counter_1.counter == 1
62 assert counter_2.counter == 1
63 assert counter_end.counter == 1