Пример #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"
Пример #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)