Exemple #1
0
 def test_calling_move_to_changes_z_height_only_after_delay(self):
     expected_height = 10.0
     expected_delay = 0.250
     test_zaxis = PhotoZAxis(0.0, expected_delay)
     test_zaxis.move_to(expected_height)
     self.assertEquals(0, test_zaxis.current_z_location_mm())
     time.sleep(expected_delay)
     self.assertEquals(expected_height, test_zaxis.current_z_location_mm())
Exemple #2
0
 def test_should_call_callback_when_something_changes(self):
     expected_height = 10.0
     expected_delay = 0.0
     test_zaxis = PhotoZAxis(0.0, expected_delay, call_back=self.call_back)
     test_zaxis.move_to(expected_height)
     test_zaxis.current_z_location_mm()
     self.assertEquals(expected_height, self.height)
     self.assertEquals(0, self.drips)
     self.assertEquals(0, self.drips_per_second)
 def _get_zaxis(self, dry_run):
     if dry_run:
         return None
     elif self._configuration.dripper.dripper_type == 'photo':
         logger.info("Photo Zaxis")
         return PhotoZAxis(self._start_height,
                           self._configuration.dripper.photo_zaxis_delay)
     elif self._configuration.dripper.dripper_type == 'emulated':
         logger.info("Emulated Zaxis")
         return TimedDripZAxis(self._configuration.dripper.drips_per_mm,
                               self._start_height,
                               drips_per_second=self._configuration.dripper.
                               emulated_drips_per_second)
     elif self._configuration.dripper.dripper_type == 'microcontroller':
         logger.info("Micro Controller Zaxis")
         return SerialDripZAxis(
             self._get_communicator(dry_run),
             self._configuration.dripper.drips_per_mm,
             self._start_height,
         )
Exemple #4
0
 def test_close_can_be_called(self):
     test_zaxis = PhotoZAxis(0.0, )
     test_zaxis.start()
     self.assertEquals(0.0, test_zaxis.current_z_location_mm())
     test_zaxis.close()
Exemple #5
0
 def test_start_should_advance(self):
     test_zaxis = PhotoZAxis(0.0, )
     test_zaxis.start()
     self.assertEquals(0.0, test_zaxis.current_z_location_mm())
Exemple #6
0
    def test_set_call_back_should_add_callback(self):
        expected_height1 = 10.0
        expected_height2 = 20.0
        expected_delay = 0.0
        test_zaxis = PhotoZAxis(0.0, expected_delay, call_back=None)
        test_zaxis.move_to(expected_height1)
        test_zaxis.current_z_location_mm()
        self.assertEquals(0, self.height)
        self.assertEquals(0, self.drips)
        self.assertEquals(0, self.drips_per_second)

        test_zaxis.set_call_back(self.call_back)

        test_zaxis.move_to(expected_height2)
        test_zaxis.current_z_location_mm()
        self.assertEquals(expected_height2, self.height)
        self.assertEquals(0, self.drips)
        self.assertEquals(0, self.drips_per_second)
Exemple #7
0
 def test_calling_move_to_changes_z_height_when_delay_0(self):
     expected_height = 10.0
     test_zaxis = PhotoZAxis(0.0, 0.0)
     test_zaxis.move_to(expected_height)
     self.assertEquals(expected_height, test_zaxis.current_z_location_mm())
Exemple #8
0
 def test_current_z_location_reports_starting_height(self):
     starting_height = 7.7
     test_zaxis = PhotoZAxis(starting_height)
     self.assertEquals(starting_height, test_zaxis.current_z_location_mm())
Exemple #9
0
 def test_current_z_location_reports_0(self):
     test_zaxis = PhotoZAxis(0.0, )
     self.assertEquals(0.0, test_zaxis.current_z_location_mm())