6 class ReturnTrueFalse(basf2.Module):
11 self.event_counter = 0
14 self.return_value(int(self.event_counter % 3))
15 self.event_counter += 1
18 class Counter(basf2.Module):
32 counter_end = Counter()
34 counter_path_0 = basf2.create_path()
35 counter_path_0.add_module(counter_0)
36 counter_path_1 = basf2.create_path()
37 counter_path_1.add_module(counter_1)
38 counter_path_2 = basf2.create_path()
39 counter_path_2.add_module(counter_2)
41 path = basf2.create_path()
42 path.add_module(
"EventInfoSetter", evtNumList=[3])
44 module_with_conditions = path.add_module(ReturnTrueFalse())
45 module_with_conditions.if_value(
"=0", counter_path_0)
46 module_with_conditions.if_value(
"=1", counter_path_1)
47 module_with_conditions.if_value(
"=2", counter_path_2, basf2.AfterConditionPath.CONTINUE)
49 path.add_module(counter_end)
53 assert counter_0.counter == 1
54 assert counter_1.counter == 1
55 assert counter_2.counter == 1
56 assert counter_end.counter == 1