示例#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
示例#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
示例#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