Skip to content

Commit

Permalink
support frozenset json serialization (faust-streaming#295)
Browse files Browse the repository at this point in the history
  • Loading branch information
YiuRULE authored and cbrand committed Jun 5, 2022
1 parent ac45ced commit cfac93e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion faust/utils/json.py
Expand Up @@ -65,7 +65,7 @@
DECIMAL_MAXLEN = 1000

#: Types that we convert to lists.
SEQUENCE_TYPES: TypeTuple[Iterable] = (set, deque)
SEQUENCE_TYPES: TypeTuple[Iterable] = (set, frozenset, deque)

DateTypeTuple = Tuple[Union[Type[datetime.date], Type[datetime.time]], ...]
DatetimeTypeTuple = Tuple[
Expand Down
1 change: 1 addition & 0 deletions tests/unit/utils/test_json.py
Expand Up @@ -69,6 +69,7 @@ def test_JSONEncoder():
assert encoder.default(datetime.now(timezone.utc))
assert encoder.default(Counter([("foo", 3), ("bar", 4)]))
assert encoder.default(uuid4())
assert encoder.default(frozenset({1, 2, 3})) == [1, 2, 3]
assert encoder.default(Flags.X) == "Xval"
assert encoder.default(Flags.Y) == "Yval"
assert encoder.default({1, 2, 3}) == [1, 2, 3]
Expand Down

0 comments on commit cfac93e

Please sign in to comment.