Exemplo n.º 1
0
def test_remove_event_detect_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.remove_event_detect(23)
        assert str(ex.value) == "Channel 23 is configured for output"
Exemplo n.º 2
0
def test_remove_event_detect():
    with patch("LPi.GPIO.sysfs"):
        GPIO.setmode(GPIO.BOARD)
        GPIO.setup(23, GPIO.IN)
        with patch("LPi.GPIO.event") as mock:
            GPIO.remove_event_detect(23)
            mock.remove_edge_detect.assert_called_with(14)