Esempio n. 1
0
 def test_process_should_adjust_laser_power(self):
     self.laser_control = LaserControl(0.5)
     self.laser_control.set_laser_on()
     sample_data_chunk = numpy.array([(0, 0)])
     micro_disseminator = MicroDisseminator(self.laser_control, self.mock_comm, 8000)
     micro_disseminator.process(sample_data_chunk)
     self.mock_comm.send.assert_called_with(MoveMessage(0, 0, 127))
Esempio n. 2
0
 def test_process_should_call_com_each_element_in_list(self):
     self.laser_control.set_laser_on()
     sample_data_chunk = numpy.array([(0.0, 1.0), (0.5, 0.0), (1.0, 0.5)])
     micro_disseminator = MicroDisseminator(self.laser_control, self.mock_comm, 8000)
     micro_disseminator.process(sample_data_chunk)
     self.mock_comm.send.assert_has_calls([
         call(MoveMessage(0,     self.max_value, 255)),
         call(MoveMessage(self.max_value / 2, 0,     255)),
         call(MoveMessage(self.max_value, self.max_value / 2, 255)),
         ])
Esempio n. 3
0
 def test_process_should_handle_empty_lists(self):
     self.laser_control.set_laser_on()
     sample_data_chunk = numpy.array([])
     micro_disseminator = MicroDisseminator(self.laser_control, self.mock_comm, 8000)
     micro_disseminator.process(sample_data_chunk)
     self.assertEqual(0, self.mock_comm.send.call_count)
Esempio n. 4
0
 def test_process_should_call_com_with_correct_posisitions(self):
     self.laser_control.set_laser_on()
     sample_data_chunk = numpy.array([(1, 1)])
     micro_disseminator = MicroDisseminator(self.laser_control, self.mock_comm, 8000)
     micro_disseminator.process(sample_data_chunk)
     self.mock_comm.send.assert_called_with(MoveMessage(self.max_value, self.max_value, 255))
Esempio n. 5
0
 def test_process_should_call_com_with_move_when_laser_on(self):
     self.laser_control.set_laser_on()
     sample_data_chunk = numpy.array([(0, 0)])
     micro_disseminator = MicroDisseminator(self.laser_control, self.mock_comm, 8000)
     micro_disseminator.process(sample_data_chunk)
     self.mock_comm.send.assert_called_with(MoveMessage(0, 0, 255))