State the cv.boolean alignment at the definition

This commit is contained in:
J. Nick Koston
2026-08-22 23:43:38 -05:00
parent 647cd8a633
commit 9543930085
2 changed files with 7 additions and 1 deletions
+6
View File
@@ -395,6 +395,12 @@ def sort_ip_addresses(address_list: list[str]) -> list[str]:
def get_bool_env(var, default=False):
"""Read a boolean environment knob.
Accepts the same spellings as ``cv.boolean`` does in YAML, so the
environment speaks the config language's boolean dialect; anything
unrecognized falls through to ``bool(value)``.
"""
value = os.getenv(var, default)
if isinstance(value, str):
value = value.lower()
+1 -1
View File
@@ -1124,6 +1124,6 @@ def test_format_duration(seconds: float, expected: str) -> None:
def test_get_bool_env_common_spellings(
monkeypatch: pytest.MonkeyPatch, value: str, expected: bool
) -> None:
"""The common on/off spellings parse instead of reading as truthy."""
"""The cv.boolean spellings parse instead of reading as truthy."""
monkeypatch.setenv("SOME_KNOB", value)
assert helpers.get_bool_env("SOME_KNOB") is expected