示例#1
0
    def test_start_call_operator_start(self):
        simulator = Simulator()
        simulator.operator = MagicMock()
        simulator.need_init = True
        simulator.start()
        simulator.operator.start.assert_not_called()

        simulator.need_init = False
        simulator.start()
        simulator.operator.start.assert_called()
示例#2
0
 def test_run_single_call_start_and_terminate(self):
     simulator = Simulator()
     simulator.start = MagicMock()
     simulator.initialize = MagicMock()
     simulator.terminate = MagicMock()
     simulator.operator = MagicMock()
     simulator.operator.state = "terminated"
     simulator.run_single()
     simulator.start.assert_called()
     simulator.initialize.assert_called()
     simulator.terminate.assert_called()