From 63d5928cbad6bc0fa7dd4cb91ddea7c9cae54e6d Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 28 Nov 2023 15:39:04 -0600 Subject: [PATCH] Ensure calling the BLE connection unsubscribe multiple times does not raise (#782) --- tests/test_client.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test_client.py b/tests/test_client.py index 825bcd3..20f09fa 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -1821,6 +1821,15 @@ async def test_bluetooth_device_connect( await asyncio.sleep(0) assert states == [(True, 23, 0), (False, 23, 7)] + # Make sure cancel is safe to call again + cancel() + + await client.disconnect(force=True) + await asyncio.sleep(0) + assert not client._connection + # Make sure cancel is safe to call after disconnect + cancel() + @pytest.mark.asyncio async def test_bluetooth_device_connect_and_disconnect_times_out(