Deprecate dt_util.utc_to_timestamp (#131787)

This commit is contained in:
Erik Montnemery
2024-11-28 17:00:20 +01:00
committed by GitHub
parent 0389800e2a
commit bbce183faf
13 changed files with 87 additions and 80 deletions

View File

@@ -116,10 +116,14 @@ def test_utc_from_timestamp() -> None:
)
def test_timestamp_to_utc() -> None:
def test_timestamp_to_utc(caplog: pytest.LogCaptureFixture) -> None:
"""Test we can convert a utc datetime to a timestamp."""
utc_now = dt_util.utcnow()
assert dt_util.utc_to_timestamp(utc_now) == utc_now.timestamp()
assert (
"utc_to_timestamp is a deprecated function which will be removed "
"in HA Core 2026.1. Use datetime.timestamp instead" in caplog.text
)
def test_as_timestamp() -> None: