File: test_txt_properties.py

package info (click to toggle)
python-zeroconf 0.147.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,380 kB
  • sloc: python: 15,356; makefile: 23
file content (23 lines) | stat: -rw-r--r-- 618 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from __future__ import annotations

import pytest
pytest_codspeed = pytest.importorskip("pytest_codspeed")
from pytest_codspeed import BenchmarkFixture

from zeroconf import ServiceInfo

info = ServiceInfo(
    "_test._tcp.local.",
    "test._test._tcp.local.",
    properties=(
        b"\x19md=AlexanderHomeAssistant\x06pv=1.0\x14id=59:8A:0B:74:65:1D\x05"
        b"c#=14\x04s#=1\x04ff=0\x04ci=2\x04sf=0\x0bsh=ccZLPA=="
    ),
)


def test_txt_properties(benchmark: BenchmarkFixture) -> None:
    @benchmark
    def process_properties() -> None:
        info._properties = None
        info.properties  # noqa: B018