File: test_utils.py

package info (click to toggle)
bleak 2.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,076 kB
  • sloc: python: 11,282; makefile: 165; java: 105
file content (32 lines) | stat: -rw-r--r-- 907 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python

"""Tests for `bleak.backends.bluezdbus.utils` package."""

import sys

import pytest

if sys.platform != "linux":
    pytest.skip("skipping linux-only tests", allow_module_level=True)
    assert False  # HACK: work around pyright bug


def test_device_path_from_characteristic_path():
    """Test device_path_from_characteristic_path."""
    from bleak.backends.bluezdbus.utils import (  # pylint: disable=import-outside-toplevel
        device_path_from_characteristic_path,
    )

    assert (
        device_path_from_characteristic_path(
            "/org/bluez/hci0/dev_11_22_33_44_55_66/service000c/char000d"
        )
        == "/org/bluez/hci0/dev_11_22_33_44_55_66"
    )

    assert (
        device_path_from_characteristic_path(
            "/org/bluez/hci10/dev_11_22_33_44_55_66/service000c/char000d"
        )
        == "/org/bluez/hci10/dev_11_22_33_44_55_66"
    )