44import pytest
55import serial
66import zigpy .exceptions
7+ import zigpy .types as t
78
8- from zigpy_xbee import api as xbee_api , types as t , uart
9+ from zigpy_xbee import api as xbee_api , types as xbee_t , uart
910import zigpy_xbee .config
1011from zigpy_xbee .zigbee .application import ControllerApplication
1112
@@ -335,19 +336,19 @@ def _send_modem_event(api, event):
335336def test_handle_modem_status (api ):
336337 api ._running .clear ()
337338 api ._reset .set ()
338- _send_modem_event (api , xbee_api .ModemStatus .COORDINATOR_STARTED )
339+ _send_modem_event (api , xbee_t .ModemStatus .COORDINATOR_STARTED )
339340 assert api .is_running is True
340341 assert api .reset_event .is_set () is True
341342
342343 api ._running .set ()
343344 api ._reset .set ()
344- _send_modem_event (api , xbee_api .ModemStatus .DISASSOCIATED )
345+ _send_modem_event (api , xbee_t .ModemStatus .DISASSOCIATED )
345346 assert api .is_running is False
346347 assert api .reset_event .is_set () is True
347348
348349 api ._running .set ()
349350 api ._reset .clear ()
350- _send_modem_event (api , xbee_api .ModemStatus .HARDWARE_RESET )
351+ _send_modem_event (api , xbee_t .ModemStatus .HARDWARE_RESET )
351352 assert api .is_running is False
352353 assert api .reset_event .is_set () is True
353354
@@ -371,26 +372,28 @@ def test_handle_explicit_rx_indicator(api):
371372
372373
373374def _handle_tx_status (api , status , wrong_frame_id = False ):
374- status = t .TXStatus (status )
375+ status = xbee_t .TXStatus (status )
375376 frame_id = 0x12
376377 send_fut = mock .MagicMock (spec = asyncio .Future )
377378 api ._awaiting [frame_id ] = (send_fut ,)
378379 s = mock .sentinel
379380 if wrong_frame_id :
380381 frame_id += 1
381- api ._handle_tx_status (frame_id , s .dst_nwk , s .retries , status , t .DiscoveryStatus ())
382+ api ._handle_tx_status (
383+ frame_id , s .dst_nwk , s .retries , status , xbee_t .DiscoveryStatus ()
384+ )
382385 return send_fut
383386
384387
385388def test_handle_tx_status_success (api ):
386- fut = _handle_tx_status (api , t .TXStatus .SUCCESS )
389+ fut = _handle_tx_status (api , xbee_t .TXStatus .SUCCESS )
387390 assert len (api ._awaiting ) == 0
388391 assert fut .set_result .call_count == 1
389392 assert fut .set_exception .call_count == 0
390393
391394
392395def test_handle_tx_status_except (api ):
393- fut = _handle_tx_status (api , t .TXStatus .ADDRESS_NOT_FOUND )
396+ fut = _handle_tx_status (api , xbee_t .TXStatus .ADDRESS_NOT_FOUND )
394397 assert len (api ._awaiting ) == 0
395398 assert fut .set_result .call_count == 0
396399 assert fut .set_exception .call_count == 1
@@ -404,7 +407,7 @@ def test_handle_tx_status_unexpected(api):
404407
405408
406409def test_handle_tx_status_duplicate (api ):
407- status = t .TXStatus .SUCCESS
410+ status = xbee_t .TXStatus .SUCCESS
408411 frame_id = 0x12
409412 send_fut = mock .MagicMock (spec = asyncio .Future )
410413 send_fut .set_result .side_effect = asyncio .InvalidStateError
@@ -418,16 +421,16 @@ def test_handle_tx_status_duplicate(api):
418421
419422def test_handle_registration_status (api ):
420423 frame_id = 0x12
421- status = xbee_api .RegistrationStatus .SUCCESS
424+ status = xbee_t .RegistrationStatus .SUCCESS
422425 fut = asyncio .Future ()
423426 api ._awaiting [frame_id ] = (fut ,)
424427 api ._handle_registration_status (frame_id , status )
425428 assert fut .done () is True
426- assert fut .result () == xbee_api .RegistrationStatus .SUCCESS
429+ assert fut .result () == xbee_t .RegistrationStatus .SUCCESS
427430 assert fut .exception () is None
428431
429432 frame_id = 0x13
430- status = xbee_api .RegistrationStatus .KEY_TABLE_IS_FULL
433+ status = xbee_t .RegistrationStatus .KEY_TABLE_IS_FULL
431434 fut = asyncio .Future ()
432435 api ._awaiting [frame_id ] = (fut ,)
433436 api ._handle_registration_status (frame_id , status )
0 commit comments