Skip to content

Commit

Permalink
Decode json bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
Bento007 committed Dec 16, 2019
1 parent 50fadf0 commit c89650e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ def normalize_json(src: typing.Union[str, dict]):
"Normalize the shape of json to make comparing easier"
if isinstance(src, dict):
pass
if isinstance(src, str):
elif isinstance(src, str):
src = json.loads(src)
elif isinstance(src, bytes):
src = json.loads(src.decode())
return json.dumps(src, sort_keys=True)


Expand Down

0 comments on commit c89650e

Please sign in to comment.