Esempio n. 1
0
def test_alive_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.alive()

    assert serial.received == ALIVE
Esempio n. 2
0
def test_alive_nak():
    # send out an NAK byte
    serial = MockSerial(NAK)

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

    assert serial.received == ALIVE
    assert result == False
Esempio n. 3
0
def test_alive_ack():
    # send out an ACK byte
    serial = MockSerial(ACK)

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

    assert serial.received == ALIVE
    assert result == True