Skip to content
This repository has been archived by the owner on Jul 16, 2021. It is now read-only.

Commit

Permalink
Rename 'get_sendevent' to 'learn_sendevent' (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffLIrion committed May 16, 2020
1 parent 6b1c449 commit 433edbe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions aio_androidtv/basetv.py
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,7 @@ async def volume_down(self, current_volume_level=None):
# Miscellaneous methods #
# #
# ======================================================================= #
async def get_sendevent(self, timeout_s=8):
async def learn_sendevent(self, timeout_s=8):
"""Capture an event (e.g., a button press) via ``getevent`` and convert it into ``sendevent`` commands.
For more info, see:
Expand All @@ -1185,12 +1185,12 @@ async def get_sendevent(self, timeout_s=8):

@staticmethod
def _parse_getevent_line(line):
"""Parse a line of the output received in ``get_sendevent``.
"""Parse a line of the output received in ``learn_sendevent``.
Parameters
----------
line : str
A line of output from ``get_sendevent``
A line of output from ``learn_sendevent``
Returns
-------
Expand Down
6 changes: 3 additions & 3 deletions tests/test_basetv.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,12 +470,12 @@ async def test_wake_lock_size(self):
self.assertIsNone(await self.btv.wake_lock_size())

@awaiter
async def test_get_sendevent(self):
"""Check that the ``get_sendevent`` method works correctly.
async def test_learn_sendevent(self):
"""Check that the ``learn_sendevent`` method works correctly.
"""
with patchers.patch_shell("add device 1: /dev/input/event4\r\n name: \"Amazon Fire TV Remote\"\r\nadd device 2: /dev/input/event3\r\n name: \"kcmouse\"\r\ncould not get driver version for /dev/input/mouse0, Not a typewriter\r\nadd device 3: /dev/input/event2\r\n name: \"amazon_touch\"\r\nadd device 4: /dev/input/event1\r\n name: \"hdmipower\"\r\nadd device 5: /dev/input/event0\r\n name: \"mtk-kpd\"\r\ncould not get driver version for /dev/input/mice, Not a typewriter\r\n/dev/input/event4: 0004 0004 00070051\r\n/dev/input/event4: 0001 006c 00000001\r\n/dev/input/event4: 0000 0000 00000000\r\n/dev/input/event4: 0004 0004 00070051\r\n/dev/input/event4: 0001 006c 00000000\r\n/dev/input/event4: 0000 0000 00000000\r\nyour command was interrupted")[self.PATCH_KEY]:
self.assertEqual(await self.btv.get_sendevent(), "sendevent /dev/input/event4 4 4 458833 && sendevent /dev/input/event4 1 108 1 && sendevent /dev/input/event4 0 0 0 && sendevent /dev/input/event4 4 4 458833 && sendevent /dev/input/event4 1 108 0 && sendevent /dev/input/event4 0 0 0")
self.assertEqual(await self.btv.learn_sendevent(), "sendevent /dev/input/event4 4 4 458833 && sendevent /dev/input/event4 1 108 1 && sendevent /dev/input/event4 0 0 0 && sendevent /dev/input/event4 4 4 458833 && sendevent /dev/input/event4 1 108 0 && sendevent /dev/input/event4 0 0 0")


class TestHAStateDetectionRulesValidator(unittest.TestCase):
Expand Down

0 comments on commit 433edbe

Please sign in to comment.