tests.test_cli_decode module — hid-tools documentation

# tests.test_cli_decode module

class HidDecodeOutput(lines: list[str])

  Bases: `object`

  The stdout from hid-decode in various converted formats

  property as_bytes: bytes
  property as_int_list: list[int]

    Convert the hid-decode output into a list of bytes

  property as_str: str
  classmethod from_file(path: Path) → HidDecodeOutput
  property initial_rdesc_dump: list[str]

    Returns the initial dump of the human-readable report descriptor with the comment prefixes removed

  lines: list[str]

class TestHidRecorder

  Bases: `object`

  pytestmark = [Mark(name='parametrize', args=('args', [[], ['--verbose']]), kwargs={'ids': ['none', 'verbose']})]
  test_basic_elements(args, rdesc)
  test_dump(args, rdescriptor, usage_id, usage)
  test_format(args, rdesc)
  test_read(args, rdesc)

class TestHidRecorderOnUHIDDevice

  Bases: `object`

  test_pass_event_node(uhid_rdesc, uhid_device, node)
  test_rdesc_match(uhid_rdesc)

    Check that the rdesc printed matches the one we get back from hid-decode.

  test_sysfs_rdesc_match(uhid_rdesc, uhid_device)

    After creating our uhid device, make sure that the report descriptor bytes in sysfs match the ones we’ve created the device with.

  uhid_device(uhid_rdesc) → Iterator[UHIDTestDevice]
  uhid_rdesc() → list[int]

rdesc(request) → Iterator[str | bytes]

run_hid_decode(args: list[str], data: str | bytes | None, source_file: Path | None = None) → HidDecodeOutput