1010
1111from zigpy_xbee import api as xbee_api , types as xbee_t , uart
1212import zigpy_xbee .config
13+ from zigpy_xbee .exceptions import ATCommandError , ATCommandException , InvalidCommand
1314from zigpy_xbee .zigbee .application import ControllerApplication
1415
1516import tests .async_mock as mock
@@ -327,7 +328,16 @@ def test_handle_at_response_error(api):
327328 status , response = 1 , 0x23
328329 fut = _handle_at_response (api , tsn , status , [response ])
329330 assert fut .done () is True
330- assert fut .exception () is not None
331+ assert isinstance (fut .exception (), ATCommandError )
332+
333+
334+ def test_handle_at_response_invalid_command (api ):
335+ """Test invalid AT command response."""
336+ tsn = 123
337+ status , response = 2 , 0x23
338+ fut = _handle_at_response (api , tsn , status , [response ])
339+ assert fut .done () is True
340+ assert isinstance (fut .exception (), InvalidCommand )
331341
332342
333343def test_handle_at_response_undef_error (api ):
@@ -336,7 +346,7 @@ def test_handle_at_response_undef_error(api):
336346 status , response = 0xEE , 0x23
337347 fut = _handle_at_response (api , tsn , status , [response ])
338348 assert fut .done () is True
339- assert fut .exception () is not None
349+ assert isinstance ( fut .exception (), ATCommandException )
340350
341351
342352def test_handle_remote_at_rsp (api ):
0 commit comments