forked from home-assistant/core
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_backports.py
41 lines (34 loc) · 976 Bytes
/
test_backports.py
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
33
34
35
36
37
38
39
40
41
"""Test backports package."""
from __future__ import annotations
from enum import StrEnum
from functools import cached_property # pylint: disable=hass-deprecated-import
from types import ModuleType
from typing import Any
import pytest
from homeassistant.backports import (
enum as backports_enum,
functools as backports_functools,
)
from .common import import_and_test_deprecated_alias
@pytest.mark.parametrize(
("module", "replacement", "breaks_in_ha_version"),
[
(backports_enum, StrEnum, "2025.5"),
(backports_functools, cached_property, "2025.5"),
],
)
def test_deprecated_aliases(
caplog: pytest.LogCaptureFixture,
module: ModuleType,
replacement: Any,
breaks_in_ha_version: str,
) -> None:
"""Test deprecated aliases."""
alias_name = replacement.__name__
import_and_test_deprecated_alias(
caplog,
module,
alias_name,
replacement,
breaks_in_ha_version,
)