def test_one_led() -> None: """Test that we can only control LED 0.""" backend = SBArduinoConsoleBackend("test") with pytest.raises(ValueError): backend.set_led_state(1, False) with pytest.raises(ValueError): backend.get_led_state(1)
def test_get_led_state() -> None: """Test that we can get the LED state.""" backend = SBArduinoConsoleBackend( "TestBoard", console_class=MockConsole, ) assert not backend.get_led_state(0) backend._pins[13].digital_state = True assert backend.get_led_state(0)
def test_set_led_state() -> None: """Test that we can set the LED state.""" backend = SBArduinoConsoleBackend( "TestBoard", console_class=MockConsole, ) backend._console.expects = "Set pin 13 state to False" # type: ignore backend.set_led_state(0, False) assert not backend.get_led_state(0) backend._console.expects = "Set pin 13 state to True" # type: ignore backend.set_led_state(0, True) assert backend.get_led_state(0)
def test_that_led_is_pin_13() -> None: """Test that the LED has the same state as Pin 13.""" backend = SBArduinoConsoleBackend( "TestBoard", console_class=MockConsole, ) backend._console.expects = "Set pin 13 state to False" # type: ignore backend.set_led_state(0, False) assert not backend.get_led_state(0)