Improve bad JSON data reporting (#47932)
* Improve bad data reporting * Fix tests Co-authored-by: Erik <erik@montnemery.com>
This commit is contained in:
parent
9ec4c07753
commit
7fe3c472e9
3 changed files with 28 additions and 10 deletions
|
@ -153,7 +153,7 @@ def test_find_unserializable_data():
|
|||
[State("mock_domain.mock_entity", "on", {"bad": bad_data})],
|
||||
dump=partial(dumps, cls=MockJSONEncoder),
|
||||
)
|
||||
== {"$[0](state: mock_domain.mock_entity).attributes.bad": bad_data}
|
||||
== {"$[0](State: mock_domain.mock_entity).attributes.bad": bad_data}
|
||||
)
|
||||
|
||||
assert (
|
||||
|
@ -161,5 +161,20 @@ def test_find_unserializable_data():
|
|||
[Event("bad_event", {"bad_attribute": bad_data})],
|
||||
dump=partial(dumps, cls=MockJSONEncoder),
|
||||
)
|
||||
== {"$[0](event: bad_event).data.bad_attribute": bad_data}
|
||||
== {"$[0](Event: bad_event).data.bad_attribute": bad_data}
|
||||
)
|
||||
|
||||
class BadData:
|
||||
def __init__(self):
|
||||
self.bla = bad_data
|
||||
|
||||
def as_dict(self):
|
||||
return {"bla": self.bla}
|
||||
|
||||
assert (
|
||||
find_paths_unserializable_data(
|
||||
BadData(),
|
||||
dump=partial(dumps, cls=MockJSONEncoder),
|
||||
)
|
||||
== {"$(BadData).bla": bad_data}
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue