def test_pin_mutability() -> None: """ Test the mutability of GPIOPins. Ensures that GPIOPin objects cannot be lost. """ ruggeduino = Ruggeduino("SERIAL0", MockRuggeduinoBackend()) with pytest.raises(TypeError): ruggeduino.pins[2] = True # type: ignore
def test_ruggeduino_supported_components() -> None: """Test that the Ruggeduino supports the required components.""" assert { GPIOPin, LED, StringCommandComponent, }.issubset(Ruggeduino.supported_components())
def test_ruggeduino_pins() -> None: """Test the pins of the Ruggeduino.""" ruggeduino = Ruggeduino("SERIAL0", MockRuggeduinoBackend()) assert len(ruggeduino.pins) == 12 + 6 for i in range(2, 14): assert isinstance(ruggeduino.pins[i], GPIOPin) for j in Ruggeduino.AnaloguePin: assert isinstance(ruggeduino.pins[j], GPIOPin)
def test_ruggeduino_name() -> None: """Test the name attribute of the Ruggeduino.""" ruggeduino = Ruggeduino("SERIAL0", MockRuggeduinoBackend()) assert ruggeduino.name == "Ruggeduino"
def test_ruggeduino_initialisation() -> None: """Test that we can initialise a Ruggeduino.""" Ruggeduino("SERIAL0", MockRuggeduinoBackend())
def test_ruggeduino_command() -> None: """Test that the Ruggeduino has a serial command component.""" ruggeduino = Ruggeduino("Serial0", MockRuggeduinoBackend()) assert isinstance(ruggeduino.command, StringCommandComponent)
def test_ruggeduino_make_safe() -> None: """Test the make_safe method of the Ruggeduino.""" ruggeduino = Ruggeduino("SERIAL0", MockRuggeduinoBackend()) ruggeduino.make_safe()
def test_ruggeduino_firmware_version() -> None: """Test the firmware_version attribute of the Ruggeduino.""" ruggeduino = Ruggeduino("SERIAL0", MockRuggeduinoBackend()) assert ruggeduino.firmware_version is None
def test_ruggeduino_serial_number() -> None: """Test the serial_number attribute of the Ruggeduino.""" ruggeduino = Ruggeduino("SERIAL0", MockRuggeduinoBackend()) assert ruggeduino.serial_number == "SERIAL0"