Skip to content

Commit a988581

Browse files
committed
Revert datetime addition to case
Signed-off-by: David Rapan <[email protected]>
1 parent f5f9681 commit a988581

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

homeassistant/components/sql/util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from datetime import date, datetime
5+
from datetime import date
66
from decimal import Decimal
77
import logging
88
from typing import Any
@@ -233,7 +233,7 @@ def convert_value(value: Any) -> Any:
233233
match value:
234234
case Decimal():
235235
return float(value)
236-
case date() | datetime():
236+
case date():
237237
return value.isoformat()
238238
case bytes() | bytearray():
239239
return f"0x{value.hex()}"

tests/components/sql/test_util.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,11 @@ async def test_invalid_sql_queries(
7878
[
7979
(Decimal("199.99"), 199.99),
8080
(date(2023, 1, 15), "2023-01-15"),
81-
(datetime(2023, 1, 15, 12, 30, 45, tzinfo=UTC), "2023-01-15T12:30:45+00:00"),
8281
(b"\xde\xad\xbe\xef", "0xdeadbeef"),
82+
(
83+
datetime(2023, 1, 15, 12, 30, 45, tzinfo=UTC),
84+
datetime(2023, 1, 15, 12, 30, 45, tzinfo=UTC),
85+
),
8386
("deadbeef", "deadbeef"),
8487
(199.99, 199.99),
8588
(69, 69),

0 commit comments

Comments
 (0)