Esempio n. 1
0
def test_reset_left_encoder_invalid():
    serial = MockSerial(INVALID_RESPONSE)
    attiny = AttinyProtocol(serial)

    with pytest.raises(InvalidResponseException):
        attiny.reset_left_encoder()

    assert serial.received == ENCODERS_RESET_LEFT
Esempio n. 2
0
def test_reset_left_encoder_timeout():
    serial = MockSerial(b'')
    attiny = AttinyProtocol(serial)

    result = attiny.reset_left_encoder()

    assert serial.received == ENCODERS_RESET_LEFT
    assert result == False
Esempio n. 3
0
def test_reset_left_encoder():
    serial = MockSerial(ACK)
    attiny = AttinyProtocol(serial)

    result = attiny.reset_left_encoder()

    assert serial.received == ENCODERS_RESET_LEFT
    assert result == True