Exemple #1
0
	def test_currentStateIsStopped_inputInvalidCommandForThisState_raiseException(self):
		with self.assertRaises(ValueError):
			state_table.get_next_state(MachineState.STOPPED, MachineCommand.PROCESS)
    def set_current_state(self, command):
        if not MachineCommand.contains(command):
            raise ValueError('Invalid command!')

        self._previous_state = self._state
        self._state = state_table.get_next_state(self._state, command)
Exemple #3
0
	def test_currentStateIsProcessing_inputStop_returnsStopped(self):
		actual_state = state_table.get_next_state(MachineState.PROCESSING, MachineCommand.STOP)
		assert_that(MachineState.STOPPED).is_equal_to(actual_state)
Exemple #4
0
	def test_currentStateIsCollecting_inputStop_returnsStopped(self):
		actual_state = state_table.get_next_state(MachineState.COLLECTING, MachineCommand.STOP)
		assert_that(MachineState.STOPPED).is_equal_to(actual_state)
Exemple #5
0
	def test_currentStateIsCollecting_inputProcess_returnsProcessing(self):
		actual_state = state_table.get_next_state(MachineState.COLLECTING, MachineCommand.PROCESS)
		assert_that(MachineState.PROCESSING).is_equal_to(actual_state)
Exemple #6
0
	def test_currentStateIsStarted_inputStop_returnsStopped(self):
		actual_state = state_table.get_next_state(MachineState.STARTED, MachineCommand.STOP)
		assert_that(MachineState.STOPPED).is_equal_to(actual_state)
Exemple #7
0
	def test_currentStateIsStarted_inputCollect_returnsCollecting(self):
		actual_state = state_table.get_next_state(MachineState.STARTED, MachineCommand.COLLECT)
		assert_that(MachineState.COLLECTING).is_equal_to(actual_state)