|
@@ -120,7 +120,7 @@ def test___enter___unsupported_chip_version(transceiver):
|
|
ValueError,
|
|
ValueError,
|
|
match=r"^{}$".format(
|
|
match=r"^{}$".format(
|
|
re.escape(
|
|
re.escape(
|
|
- "unsupported chip version 0x15 (expected one of [0x04, 0x14])"
|
|
+ "Unsupported chip version 0x15 (expected one of [0x04, 0x14])"
|
|
)
|
|
)
|
|
),
|
|
),
|
|
):
|
|
):
|
|
@@ -128,6 +128,25 @@ def test___enter___unsupported_chip_version(transceiver):
|
|
pass
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
+def test___enter___chip_version_zero(transceiver):
|
|
|
|
+ with unittest.mock.patch.object(
|
|
|
|
+ transceiver, "_read_status_register"
|
|
|
|
+ ) as read_status_register_mock, unittest.mock.patch.object(transceiver, "_reset"):
|
|
|
|
+ read_status_register_mock.side_effect = lambda r: {
|
|
|
|
+ cc1101.addresses.StatusRegisterAddress.PARTNUM: 0x00,
|
|
|
|
+ cc1101.addresses.StatusRegisterAddress.VERSION: 0x00,
|
|
|
|
+ }[r]
|
|
|
|
+ with pytest.raises(
|
|
|
|
+ ValueError,
|
|
|
|
+ match=r"^Unsupported chip version 0x00 \(expected one of \[0x04, 0x14\]\)"
|
|
|
|
+ r"\n\nPlease verify that all required pins are connected"
|
|
|
|
+ r" \(see https://github\.com/fphammerle/python\-cc1101\#wiring\-raspberry\-pi\)"
|
|
|
|
+ r" and that you selected the correct SPI bus and chip/slave select line\.$",
|
|
|
|
+ ):
|
|
|
|
+ with transceiver:
|
|
|
|
+ pass
|
|
|
|
+
|
|
|
|
+
|
|
@pytest.mark.parametrize("bus", [0, 1])
|
|
@pytest.mark.parametrize("bus", [0, 1])
|
|
@pytest.mark.parametrize("chip_select", [0, 2])
|
|
@pytest.mark.parametrize("chip_select", [0, 2])
|
|
def test___enter__permission_error(transceiver, bus, chip_select):
|
|
def test___enter__permission_error(transceiver, bus, chip_select):
|