|
@@ -35,6 +35,18 @@ def test_get_sync_word(transceiver, xfer_return_value, sync_word):
|
|
|
transceiver._spi.xfer.assert_called_once_with([0x04 | 0xC0, 0, 0])
|
|
|
|
|
|
|
|
|
+def test_set_sync_word(transceiver):
|
|
|
+ transceiver._spi.xfer.return_value = [15, 15, 15]
|
|
|
+ transceiver.set_sync_word(b"\x12\x34")
|
|
|
+ transceiver._spi.xfer.assert_called_once_with([0x04 | 0x40, 0x12, 0x34])
|
|
|
+
|
|
|
+
|
|
|
+@pytest.mark.parametrize("sync_word", [b"", b"\0", "\x12\x34\x56"])
|
|
|
+def test_set_sync_word_invalid_length(transceiver, sync_word):
|
|
|
+ with pytest.raises(ValueError, match=r"\bexpected two bytes\b"):
|
|
|
+ transceiver.set_sync_word(sync_word)
|
|
|
+
|
|
|
+
|
|
|
_FREQUENCY_CONTROL_WORD_HERTZ_PARAMS = [
|
|
|
([0x10, 0xA7, 0x62], 433000000),
|
|
|
([0x10, 0xAB, 0x85], 433420000),
|