def test_init_machine_with_nested_states(self): a = State('A') b = State('B') b_1 = State('1', parent=b) b_2 = State('2', parent=b) m = self.stuff.machine_cls(states=[a, b]) self.assertEqual(b_1.name, 'B{0}1'.format(state_separator)) m.to("B{0}1".format(state_separator))
def test_init_machine_with_hella_arguments(self): states = [ State('State1'), 'State2', { 'name': 'State3', 'on_enter': 'hello_world' } ] transitions = [{ 'trigger': 'advance', 'source': 'State2', 'dest': 'State3' }] s = Stuff() self.stuff.machine_cls(model=s, states=states, transitions=transitions, initial='State2') s.advance() self.assertEqual(s.message, 'Hello World!')