예제 #1
0
파일: tests.py 프로젝트: caryt/utensils
 def test_stateMachine_transitions_byAssignment(self):
     """Test State Transations from State 1 to State2."""
     machine                                     = StateMachine(State1)
     self.assertRaises(StateError,               machine.goto, State1)
     self.assertTrue(machine.inState(State1))
     machine.state = State2
     self.assertEqual(machine.message,           'Entered State 2')
     self.assertTrue(machine.inState(State2))
예제 #2
0
파일: tests.py 프로젝트: caryt/utensils
 def test_stateMachine_finalState(self):
     """Test Final State."""
     machine                                     = StateMachine(State1)
     self.assertTrue(machine.inState(State1))
     machine.goto(State2)
     self.assertTrue(machine.inState(State2))
     self.assertFalse(State1 in machine.state.movesTo)
     self.assertFalse(State2 in machine.state.movesTo)
     self.assertRaises(StateError,               machine.goto, State1)
     self.assertRaises(StateError,               machine.goto, State2)
     self.assertTrue(machine.inState(State2))
예제 #3
0
파일: tests.py 프로젝트: caryt/utensils
    def test_stateMachine_initialState(self):
        """Test State Machine Initial set up."""
        machine                                     = StateMachine(State1)

        self.assertTrue(machine.inState(State1))
        self.assertFalse(State1 in machine.state.movesTo)
        self.assertTrue(State2 in machine.state.movesTo)