Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/syrupy/extensions/json/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def _filter(
elif matcher:
data = matcher(data=data, path=path)

if isinstance(data, (int, float, str)):
if isinstance(data, (int, float, str)) or data is None:
return data

filtered_dct: Dict[Any, Any]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"empty_dict": {},
"empty_list": [],
"none": "None"
"none": null
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"datetime": "2021-01-31T23:59:00.000000",
"float": 4.2,
"int": -1,
"null": "None",
"null": null,
"str": "foo"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"a": "Some ttext.",
"key": null,
"multi\nline\nkey": "Some morre text."
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"None"
null
1 change: 1 addition & 0 deletions tests/syrupy/extensions/json/test_json_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ def test_set(snapshot_json, actual):
"multi\nline\nkey": "Some morre text.",
frozenset({"1", "2"}): ["1", 2],
ExampleTuple(a=1, b=2, c=3, d=4): {"e": False},
"key": None,
},
{},
{"key": ["line1\nline2"]},
Expand Down