def test_add_event_callback_not_configured_for_input(): with patch("LPi.GPIO.sysfs"): GPIO.setmode(GPIO.BOARD) GPIO.setup(23, GPIO.OUT) with pytest.raises(RuntimeError) as ex: GPIO.add_event_callback(23, None) assert str(ex.value) == "Channel 23 is configured for output"
def test_add_event_callback(): with patch("LPi.GPIO.sysfs"): GPIO.setmode(GPIO.BOARD) GPIO.setup(23, GPIO.IN) with patch("LPi.GPIO.event") as mock: GPIO.add_event_callback(23, None) mock.add_edge_callback(14, None)