mirror of
https://github.com/home-assistant/core.git
synced 2025-12-26 05:57:01 +00:00
Remove deprecated square meters constant (#155954)
This commit is contained in:
@@ -685,13 +685,6 @@ class UnitOfArea(StrEnum):
|
||||
HECTARES = "ha"
|
||||
|
||||
|
||||
_DEPRECATED_AREA_SQUARE_METERS: Final = DeprecatedConstantEnum(
|
||||
UnitOfArea.SQUARE_METERS,
|
||||
"2025.12",
|
||||
)
|
||||
"""Deprecated: please use UnitOfArea.SQUARE_METERS"""
|
||||
|
||||
|
||||
# Mass units
|
||||
class UnitOfMass(StrEnum):
|
||||
"""Mass units."""
|
||||
|
||||
@@ -1,43 +1,10 @@
|
||||
"""Test const module."""
|
||||
|
||||
from enum import Enum
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant import const
|
||||
|
||||
from .common import help_test_all, import_and_test_deprecated_constant
|
||||
|
||||
|
||||
def _create_tuples(
|
||||
value: type[Enum] | list[Enum], constant_prefix: str
|
||||
) -> list[tuple[Enum, str]]:
|
||||
return [(enum, constant_prefix) for enum in value]
|
||||
from .common import help_test_all
|
||||
|
||||
|
||||
def test_all() -> None:
|
||||
"""Test module.__all__ is correctly set."""
|
||||
help_test_all(const)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("replacement", "constant_name", "breaks_in_version"),
|
||||
[
|
||||
(const.UnitOfArea.SQUARE_METERS, "AREA_SQUARE_METERS", "2025.12"),
|
||||
],
|
||||
)
|
||||
def test_deprecated_constant_name_changes(
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
replacement: Enum,
|
||||
constant_name: str,
|
||||
breaks_in_version: str,
|
||||
) -> None:
|
||||
"""Test deprecated constants, where the name is not the same as the enum value."""
|
||||
import_and_test_deprecated_constant(
|
||||
caplog,
|
||||
const,
|
||||
constant_name,
|
||||
f"{replacement.__class__.__name__}.{replacement.name}",
|
||||
replacement,
|
||||
breaks_in_version,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user