Area units and conversion between metric and US (#123563)
* area conversions * start work on tests * add number device class * update unit conversions to utilise distance constants * add area unit * update test unit system * update device condition and trigger * update statistic unit converters * further tests work WIP * update test unit system * add missing string translations * fix websocket tests * add deprecated notice * add more missing strings and missing initialisation of unit system * adjust icon and remove strings from scrape and random * Fix acre to meters conversion Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Tidy up valid units Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * fix ordering of area * update order alphabetically * fix broken test * update test_init * Update homeassistant/const.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * remove deprecated unit and fix alphabetical order * change deprecation and add tests, change to millimeter conversion for inches * fix order * re-order defs alphabetically * add measurement as well * update icons * fix up Deprecation of area square meters * Update core integrations to UnitOfArea * update test recorder tests * unit system tests in alphabetical * update snapshot * rebuild * revert alphabetization of functions * other revert of alphabetical order --------- Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
This commit is contained in:
@@ -177,18 +177,24 @@ def test_deprecated_constants(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("replacement", "constant_name"),
|
||||
("replacement", "constant_name", "breaks_in_version"),
|
||||
[
|
||||
(const.UnitOfLength.YARDS, "LENGTH_YARD"),
|
||||
(const.UnitOfSoundPressure.DECIBEL, "SOUND_PRESSURE_DB"),
|
||||
(const.UnitOfSoundPressure.WEIGHTED_DECIBEL_A, "SOUND_PRESSURE_WEIGHTED_DBA"),
|
||||
(const.UnitOfVolume.FLUID_OUNCES, "VOLUME_FLUID_OUNCE"),
|
||||
(const.UnitOfLength.YARDS, "LENGTH_YARD", "2025.1"),
|
||||
(const.UnitOfSoundPressure.DECIBEL, "SOUND_PRESSURE_DB", "2025.1"),
|
||||
(
|
||||
const.UnitOfSoundPressure.WEIGHTED_DECIBEL_A,
|
||||
"SOUND_PRESSURE_WEIGHTED_DBA",
|
||||
"2025.1",
|
||||
),
|
||||
(const.UnitOfVolume.FLUID_OUNCES, "VOLUME_FLUID_OUNCE", "2025.1"),
|
||||
(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(
|
||||
@@ -197,7 +203,7 @@ def test_deprecated_constant_name_changes(
|
||||
constant_name,
|
||||
f"{replacement.__class__.__name__}.{replacement.name}",
|
||||
replacement,
|
||||
"2025.1",
|
||||
breaks_in_version,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user