Exemplo n.º 1
0
def test_stop_motors_undefined():
    # send out something that is neither an ACK or a NAK byte
    serial = MockSerial(INVALID_RESPONSE)

    attiny = AttinyProtocol(serial)
    with pytest.raises(InvalidResponseException):
        attiny.stop_motors()

    assert serial.received == STOP_MOTORS
Exemplo n.º 2
0
def test_stop_motors_timeout():
    serial = MockSerial(b'')

    attiny = AttinyProtocol(serial)
    result = attiny.stop_motors()

    assert serial.received == STOP_MOTORS

    assert result == False
Exemplo n.º 3
0
def test_stop_motors():
    serial = MockSerial(ACK)

    attiny = AttinyProtocol(serial)
    result = attiny.stop_motors()

    assert serial.received == STOP_MOTORS

    assert result == True