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