File: __init__.py

package info (click to toggle)
python-rokuecp 0.19.5-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 668 kB
  • sloc: python: 2,193; xml: 547; makefile: 3
file content (24 lines) | stat: -rw-r--r-- 629 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
24
"""Tests for Roku."""
from __future__ import annotations

import os
import socket


def fake_addrinfo_results(
    hosts: list[str],
    family: int = socket.AF_INET,
) -> list[tuple[int, None, None, None, list[str | int]]]:
    """Resolve hostname for mocked testing."""
    return [(family, None, None, None, [h, 0]) for h in hosts]


def load_fixture(filename: str) -> str:
    """Load a fixture."""
    path = os.path.join(  # noqa: PTH118
        os.path.dirname(__file__),  # noqa: PTH120
        "fixtures",
        filename,
    )
    with open(path, encoding="utf-8") as fptr:  # noqa: PTH123
        return fptr.read()