mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Inverse json import logic (#88099)
* Fix helpers and util * Adjust components * Move back errors * Add report * mypy * mypy * Assert deprecation messages * Move test_json_loads_object * Adjust tests * Fix rebase * Adjust pylint plugin * Fix plugin * Adjust references * Adjust backup tests
This commit is contained in:
@@ -13,7 +13,6 @@ from homeassistant.helpers.json import (
|
||||
json_bytes_strip_null,
|
||||
json_dumps,
|
||||
json_dumps_sorted,
|
||||
json_loads_object,
|
||||
)
|
||||
from homeassistant.util import dt as dt_util
|
||||
from homeassistant.util.color import RGBColor
|
||||
@@ -136,20 +135,3 @@ def test_json_bytes_strip_null() -> None:
|
||||
json_bytes_strip_null([[{"k1": {"k2": ["silly\0stuff"]}}]])
|
||||
== b'[[{"k1":{"k2":["silly"]}}]]'
|
||||
)
|
||||
|
||||
|
||||
def test_json_loads_object():
|
||||
"""Test json_loads_object validates result."""
|
||||
assert json_loads_object('{"c":1.2}') == {"c": 1.2}
|
||||
with pytest.raises(
|
||||
ValueError, match="Expected JSON to be parsed as a dict got <class 'list'>"
|
||||
):
|
||||
json_loads_object("[]")
|
||||
with pytest.raises(
|
||||
ValueError, match="Expected JSON to be parsed as a dict got <class 'bool'>"
|
||||
):
|
||||
json_loads_object("true")
|
||||
with pytest.raises(
|
||||
ValueError, match="Expected JSON to be parsed as a dict got <class 'NoneType'>"
|
||||
):
|
||||
json_loads_object("null")
|
||||
|
||||
Reference in New Issue
Block a user