def test_adjust_command_causes_user_limits_to_be_updated(self): # Get initial limits low, high = self.motor.userlimits # Redefine current position using 'adjust' new_pos = 50 adjust(self.motor, new_pos) # Check new limits assert (low + new_pos, high + new_pos) == self.motor.userlimits
def test_adjust_command_sets_offset_correctly(self): # Initial offset should be 0 assert self.motor.offset == 0 # Redefine current position using 'adjust' new_pos = 50 adjust(self.motor, new_pos) # Check new offset value assert new_pos == self.motor.offset
def test_adjust(self, session, log): """Check adjust() command.""" motor = session.getDevice('motor') maw(motor, 1) adjust(motor, 0) assert motor() == 0 assert motor.offset == 1 assert motor.target == 0 adjust(motor, 0, 1) assert motor() == 1 assert motor.offset == 0 assert motor.target == 1
def test_adjust_alias(session, log): alias = session.getDevice('aliasDev3', object) # now set the alias to some object axis = session.getDevice('axis') # "alias" is a chatty property, so it should emit something when changed with log.assert_msg_matches('alias set to'): alias.alias = axis alias.alias = axis alias.offset = 0.0 adjust(alias, 1) assert alias.offset == -1.0 assert axis.offset == -1.0 adjust(alias, 0) assert alias.offset == 0.0 assert axis.offset == 0.0
def test_offsets(self, session): d = session.getDevice('zb1') # only adjust to new value assert d.read(0) == 0 adjust(d, 0.5) # check for offset and mode specific offset assert d._offsets['slit'] == -0.5 assert d.offset == -0.5 # change mode, maw away and adjust again d.mode = 'gisans' d.wait() # assert raises(KeyError, d._offsets['gisans']) d.maw(-1) adjust(d, 0) # check for offset and mode specific offset assert d._offsets['gisans'] == -1 assert d.offset == -1 # check for the mode specific offsets assert (d._offsets['slit'], d._offsets['gisans']) == (-0.5, -1.)