Exemple #1
0
 def test_finalStateDispatch_counts(self):
     self.context.currentState = self.stateNormal
     self.context.dispatch('next-event', {})
     self.assertEqual(
         {
             'state-initial': {
                 'entry': 0,
                 'action': 0,
                 'exit': 0
             },
             'state-normal': {
                 'entry': 0,
                 'action': 0,
                 'exit': 1
             },
             'state-final': {
                 'entry': 1,
                 'action': 1,
                 'exit': 0
             },
             'state-initial--next-event': {
                 'action': 0
             },
             'state-normal--next-event': {
                 'action': 1
             }
         }, getCounts(self.machineConfig))
Exemple #2
0
 def test_initialialize_counts(self):
     event = self.context.initialize()
     self.assertEqual('pseudo-init', event)
     self.assertEqual(
         {
             'state-initial': {
                 'entry': 0,
                 'action': 0,
                 'exit': 0
             },
             'state-normal': {
                 'entry': 0,
                 'action': 0,
                 'exit': 0
             },
             'state-final': {
                 'entry': 0,
                 'action': 0,
                 'exit': 0
             },
             'state-initial--next-event': {
                 'action': 0
             },
             'state-normal--next-event': {
                 'action': 0
             }
         }, getCounts(self.machineConfig))
Exemple #3
0
 def test_finalStateDispatch_counts(self):
     self.context.currentState = self.stateNormal
     self.context.dispatch('next-event', {})
     self.assertEqual({'state-initial': {'entry': 0, 'action': 0, 'exit': 0}, 
                       'state-normal': {'entry': 0, 'action': 0, 'exit': 1},
                       'state-final': {'entry': 1, 'action': 1, 'exit': 0},
                       'state-initial--next-event': {'action': 0},
                       'state-normal--next-event': {'action': 1}}, 
                      getCounts(self.machineConfig))
Exemple #4
0
 def test_initialialize_counts(self):
     event = self.context.initialize()
     self.assertEqual('pseudo-init', event)
     self.assertEqual({'state-initial': {'entry': 0, 'action': 0, 'exit': 0}, 
                       'state-normal': {'entry': 0, 'action': 0, 'exit': 0},
                       'state-final': {'entry': 0, 'action': 0, 'exit': 0},
                       'state-initial--next-event': {'action': 0},
                       'state-normal--next-event': {'action': 0}}, 
                      getCounts(self.machineConfig))