def test_analogue_value_setter() -> None: """Test that we can set a scaled analogue value.""" driver = MockGPIOPinDriver() pin = GPIOPin( 0, driver, initial_mode=GPIOPinMode.ANALOGUE_OUTPUT, hardware_modes={ GPIOPinMode.ANALOGUE_OUTPUT, GPIOPinMode.PWM_OUTPUT, }, ) pin.mode = GPIOPinMode.ANALOGUE_OUTPUT pin.analogue_value = 0.6 pin.mode = GPIOPinMode.PWM_OUTPUT pin.analogue_value = 0.7 with pytest.raises(ValueError): pin.analogue_value = -1
def test_analogue_value_setter(): """Test that we can set a scaled analogue value.""" driver = MockGPIOPinDriver() pin = GPIOPin( 0, MockGPIOPinBoard(), driver, supported_modes=[ GPIOPinMode.ANALOGUE_OUTPUT, GPIOPinMode.PWM_OUTPUT, ], ) pin.mode = GPIOPinMode.ANALOGUE_OUTPUT pin.analogue_value = 0.6 pin.mode = GPIOPinMode.PWM_OUTPUT pin.analogue_value = 0.7 with pytest.raises(ValueError): pin.analogue_value = -1