From 98c6e6a2ae10a3666a28e87507c8d80352a18d08 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 26 Nov 2023 17:14:41 -0600 Subject: [PATCH] Add coverage for client api_version being None after disconnected (#747) --- tests/test_client.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/test_client.py b/tests/test_client.py index 0ee120d..242f897 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -1868,3 +1868,16 @@ async def test_subscribe_voice_assistant_failure( # and does not raise unsub() assert len(send.mock_calls) == 0 + + +@pytest.mark.asyncio +async def test_api_version_after_connection_closed( + api_client: tuple[ + APIClient, APIConnection, asyncio.Transport, APIPlaintextFrameHelper + ], +) -> None: + """Test api version is None after connection close.""" + client, connection, transport, protocol = api_client + assert client.api_version == APIVersion(1, 9) + await client.disconnect(force=True) + assert client.api_version is None