def test_power_board_wait_start() -> None: """Test the wait_for_start_flash method.""" pb = PowerBoard("SERIAL0", MockPowerBoardBackend()) # Note: This isn't a great test, but ensures that the code runs at least. pb.wait_for_start_flash() assert pb._run_led.state
def test_output_mutability() -> None: """ Test the mutability of outputs. Ensures that Output objects cannot be lost. """ pb = PowerBoard("SERIAL0", MockPowerBoardBackend()) with pytest.raises(TypeError): pb.outputs[PowerOutputPosition.L0] = True # type: ignore
def test_power_board_outputs(): """Test the power outputs on the PowerBoard.""" pb = PowerBoard("SERIAL0", MockPowerBoardBackend()) assert type(pb.outputs) is PowerOutputGroup assert len(pb.outputs) == 6 assert type(pb.outputs[PowerOutputPosition.H0]) for output in pb.outputs: assert type(output) is PowerOutput
def test_power_board_error_led(): """Test the error LED on the Power Board.""" pb = PowerBoard("SERIAL0", MockPowerBoardBackend()) assert type(pb._error_led) is LED
def test_power_board_battery_sensor(): """Test the Battery Sensor on the Power Board.""" pb = PowerBoard("SERIAL0", MockPowerBoardBackend()) assert type(pb.battery_sensor) is BatterySensor
def test_power_board_button(): """Test the Button on the PowerBoard.""" pb = PowerBoard("SERIAL0", MockPowerBoardBackend()) assert type(pb.start_button) is Button
def test_power_board_piezo(): """Test the Piezo on the PowerBoard.""" pb = PowerBoard("SERIAL0", MockPowerBoardBackend()) assert type(pb.piezo) is Piezo
def test_power_board_make_safe(): """Test the make_safe method of the PowerBoard.""" pb = PowerBoard("SERIAL0", MockPowerBoardBackend()) pb.make_safe()
def test_power_board_serial(): """Test the serial attribute of the PowerBoard.""" pb = PowerBoard("SERIAL0", MockPowerBoardBackend()) assert pb.serial == "SERIAL0"
def test_power_board_name(): """Test the name attribute of the PowerBoard.""" pb = PowerBoard("SERIAL0", MockPowerBoardBackend()) assert pb.name == "Student Robotics v4 Power Board"
def test_power_board_instantiation(): """Test that we can instantiate a PowerBoard.""" PowerBoard("SERIAL0", MockPowerBoardBackend())
def test_power_board_run_led() -> None: """Test the run LED on the Power Board.""" pb = PowerBoard("SERIAL0", MockPowerBoardBackend()) assert type(pb._run_led) is LED
def test_firmware_version() -> None: """Test the firmware_version attribute of the PowerBoard.""" pb = PowerBoard("SERIAL0", MockPowerBoardBackend()) assert pb.firmware_version is None