def test_submachines_machine(self):
        states, trans = make_submachines_machine(use_logging=False)
        hsm = HSM(states, trans)

        l0_start = get_state_by_sig(('left', 0, 'start'), hsm.flattened)
        s0_top = get_state_by_sig(('subs', 0, 'top'), hsm.flattened)
        s1_final = get_state_by_sig(('subs', 1, 'final'), hsm.flattened)

        tree = tree_from_state_set( set([l0_start, s0_top, s1_final]) )
        assert len(tree) == 1  # only one root node

        assert self.extract_names(tree) == [
            ('top', [
                ('left', [
                    ('left[0].top', [
                        ('left[0].start', [])
                    ]),
                ]),
                ('right', [
                    ('subs', [
                        ('subs[0].top', []),
                        ('subs[1].top', [
                            ('subs[1].final', []),
                        ]),
                    ]),
                ])
            ]),
        ]
Ejemplo n.º 2
0
 def setup_class(self):
     states, trans = make_submachines_machine(use_logging=False)
     self.hsm = HSM(states, trans)
Ejemplo n.º 3
0
 def setup_class(self):
     states, trans = make_submachines_machine(use_logging=True)
     self.hsm = HSM(states, trans)
     self.eb = EventBus()