예제 #1
0
def test_different_calibration_unit():
    calibration = LinearCalibration(q.count / q.deg, 0 * q.deg)

    motor = DummyMotor(calibration)
    motor.position = 0 * q.deg
    motor.move(1 * q.deg).wait()
    assert motor.position == 1 * q.deg
예제 #2
0
def test_different_calibration_unit():
    calibration = LinearCalibration(q.count / q.deg, 0 * q.deg)

    motor = DummyMotor(calibration)
    motor.position = 0 * q.deg
    motor.move(1 * q.deg).wait()
    assert motor.position == 1 * q.deg
예제 #3
0
class TestDummyMotor(unittest.TestCase):
    def setUp(self):
        self.motor = DummyMotor()
        self.handler = logbook.TestHandler()
        self.handler.push_application()

    def tearDown(self):
        self.handler.pop_application()

    def test_set_position(self):
        position = 1 * q.mm
        self.motor.position = position
        self.assertEqual(position, self.motor.position)

    def test_move(self):
        position = 1 * q.mm
        delta = 0.5 * q.mm
        self.motor.position = position
        self.motor.move(delta).wait()
        self.assertEqual(position + delta, self.motor.position)

    def test_log_output(self):
        self.motor.position = 0 * q.mm
        info = "Motor: try position='0.0 mm'"
        self.assertTrue(self.handler.has_info(info))

        self.motor.position = 2 * q.mm
        info = "Motor: try position='2.0 mm'"
        self.assertTrue(self.handler.has_info(info))
예제 #4
0
class TestDummyMotor(TestCase):
    def setUp(self):
        super(TestDummyMotor, self).setUp()
        self.motor = DummyMotor()

    def test_set_position(self):
        position = 1 * q.mm
        self.motor.position = position
        self.assertEqual(position, self.motor.position)

    def test_move(self):
        position = 1 * q.mm
        delta = 0.5 * q.mm
        self.motor.position = position
        self.motor.move(delta).wait()
        self.assertEqual(position + delta, self.motor.position)
예제 #5
0
class TestDummyMotor(TestCase):

    def setUp(self):
        super(TestDummyMotor, self).setUp()
        self.motor = DummyMotor()

    def test_set_position(self):
        position = 1 * q.mm
        self.motor.position = position
        self.assertEqual(position, self.motor.position)

    def test_move(self):
        position = 1 * q.mm
        delta = 0.5 * q.mm
        self.motor.position = position
        self.motor.move(delta).wait()
        self.assertEqual(position + delta, self.motor.position)