Cache serialization of config entry storage (#127435)

This commit is contained in:
J. Nick Koston
2024-10-03 12:51:09 -05:00
committed by GitHub
parent 0bbca596a9
commit e2b1ef053f
4 changed files with 96 additions and 18 deletions

View File

@@ -18,6 +18,7 @@ from homeassistant.helpers.json import (
ExtendedJSONEncoder,
JSONEncoder as DefaultHASSJSONEncoder,
find_paths_unserializable_data,
json_bytes_sorted,
json_bytes_strip_null,
json_dumps,
json_dumps_sorted,
@@ -107,6 +108,14 @@ def test_json_dumps_sorted() -> None:
)
def test_json_bytes_sorted() -> None:
"""Test the json bytes sorted function."""
data = {"c": 3, "a": 1, "b": 2}
assert json_bytes_sorted(data) == json.dumps(
data, sort_keys=True, separators=(",", ":")
).encode("utf-8")
def test_json_dumps_float_subclass() -> None:
"""Test the json dumps a float subclass."""