def test_set_duty_cycle_invalid(self): rpi_gpio = Mock() GPIO = GPIO.TestRudderDirection(rpi_gpio) GPIO.start(12, 7.5) self.assertRaises(ValueError, GPIO.set_duty_cycle, 12, 15) self.assertRaises(ValueError, GPIO.set_duty_cycle, 12, -1)
def test_set_frequency(self): rpi_gpio = Mock() GPIO = GPIO.TestRudderDirection(rpi_gpio) GPIO.start(12, 50) GPIO.set_frequency(1, 800)
def test_set_duty_cycle_valid(self): rpi_gpio = Mock() GPIO = GPIO.TestRudderDirection(rpi_gpio) GPIO.start(12, 50) #pin and frequency of PWM GPIO.set_duty_cycle(12, 7.5)