Пример #1
0
def test_stop_buzzer():
    serial = MockSerial(ACK)
    attiny = AttinyProtocol(serial)
    result = attiny.stop_buzzer()

    assert result == True
    assert serial.received == STOP_BUZZER
Пример #2
0
def test_stop_buzzer_invalid():
    serial = MockSerial(INVALID_RESPONSE)
    attiny = AttinyProtocol(serial)

    with pytest.raises(InvalidResponseException):
        attiny.stop_buzzer()
Пример #3
0
def test_stop_buzzer_timeout():
    serial = MockSerial(b'')
    attiny = AttinyProtocol(serial)
    result = attiny.stop_buzzer()

    assert result == False
Пример #4
0
def test_stop_buzzer_nak():
    serial = MockSerial(NAK)
    attiny = AttinyProtocol(serial)
    result = attiny.stop_buzzer()

    assert result == False