def test_convert_to(self): self.assertEqual(Infinity.convert_to(1e100), Infinity.PLUS) self.assertEqual(Infinity.convert_to(-1e100), Infinity.MINUS) self.assertEqual(Infinity.convert_to(10e20), 10e20) self.assertEqual(Infinity.convert_to(-10e20), -10e20) self.assertEqual(Infinity.convert_to(float('inf')), Infinity.PLUS) self.assertEqual(Infinity.convert_to(float('-inf')), Infinity.MINUS) self.assertEqual(Infinity.convert_to(0.3333), 0.3333) self.assertEqual(Infinity.convert_to(128), 128)
def change_param(self, param, value): """Attempt to set a parameter is servo. :rtype: bool :return: True if change request was sent successfuly """ self.logger.debug('change param %s to %s', param, value) value = Infinity.convert_to(value) pa = ParamApplyRequest(param, value) return self._apply_param(pa)