Coverage for drone.py : 59%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
self.motor_speed = motor_speed self.is_turned_on = is_turned_on
def motor_speed(self): return self._motor_speed
def motor_speed(self, value): if value < self.__class__.MIN_MOTOR_SPEED: raise ValueError('The minimum speed is {0}'.format(self.__class__.MIN_MOTOR_SPEED)) if value > self.__class__.MAX_MOTOR_SPEED: raise ValueError('The maximum speed is {0}'.format(self.__class__.MAX_MOTOR_SPEED)) self._motor_speed = value self._is_turned_on = (self.motor_speed is not 0) sleep(2)
def is_turned_on(self): return self._is_turned_on
def status(self): sleep(3) return HexacopterStatus(self.motor_speed, self.is_turned_on)
def brightness_level(self):
def brightness_level(self, value): raise ValueError('The minimum brightness level is {0}'.format(self.__class__.MIN_BRIGHTNESS_LEVEL)) raise ValueError('The maximum brightness level is {0}'.format(self.__class__.MAX_BRIGHTNESS_LEVEL))
def altitude(self): sleep(1) return randint(0, 3000)
self.red_led.id: self.red_led, self.green_led.id: self.green_led, self.blue_led.id: self.blue_led}
hexacopter = Hexacopter() hexacopter.motor_speed = 100 print(hexacopter.is_turned_on) print(hexacopter.motor_speed) print(hexacopter.status.motor_speed) print(hexacopter.status.is_turned_on) |