from unittest import TestCase


class AsyncioTransportTestCase(TestCase):
    pass

from asyncio import get_event_loop
from unittest import TestCase, mock

from rfxcom.transport import AsyncioTransport

from rfxcom.protocol import RESET_PACKET, STATUS_PACKET


class AsyncioTransportTestCase(TestCase):

    def test_loop_once(self):

        loop = get_event_loop()

        def handler(*args, **kwargs):
            pass

        device = mock.MagicMock()

        AsyncioTransport(device, loop, callback=handler)
        loop._run_once()

        device.write.assert_has_call(bytearray(RESET_PACKET))
        device.write.assert_has_call(bytearray(STATUS_PACKET))

Add an initial ghetto asyncio test.
Add an initial ghetto asyncio test.
+ from asyncio import get_event_loop
- from unittest import TestCase
+ from unittest import TestCase, mock
+ 
+ from rfxcom.transport import AsyncioTransport
+ 
+ from rfxcom.protocol import RESET_PACKET, STATUS_PACKET
  
  
  class AsyncioTransportTestCase(TestCase):
-     pass
  
+     def test_loop_once(self):
+ 
+         loop = get_event_loop()
+ 
+         def handler(*args, **kwargs):
+             pass
+ 
+         device = mock.MagicMock()
+ 
+         AsyncioTransport(device, loop, callback=handler)
+         loop._run_once()
+ 
+         device.write.assert_has_call(bytearray(RESET_PACKET))
+         device.write.assert_has_call(bytearray(STATUS_PACKET))
+ 
Add an initial ghetto asyncio test.
## Code Before:
from unittest import TestCase


class AsyncioTransportTestCase(TestCase):
    pass

## Instruction:
Add an initial ghetto asyncio test.
## Code After:
from asyncio import get_event_loop
from unittest import TestCase, mock

from rfxcom.transport import AsyncioTransport

from rfxcom.protocol import RESET_PACKET, STATUS_PACKET


class AsyncioTransportTestCase(TestCase):

    def test_loop_once(self):

        loop = get_event_loop()

        def handler(*args, **kwargs):
            pass

        device = mock.MagicMock()

        AsyncioTransport(device, loop, callback=handler)
        loop._run_once()

        device.write.assert_has_call(bytearray(RESET_PACKET))
        device.write.assert_has_call(bytearray(STATUS_PACKET))
