moulinette/test/test_serialize.py
Alexandre Aubin 7674efe97f Typo
2021-08-27 22:10:06 +02:00

14 lines
439 B
Python

from datetime import datetime as dt
from moulinette.interfaces import JSONExtendedEncoder
def test_json_extended_encoder(caplog):
encoder = JSONExtendedEncoder()
assert encoder.default(set([1, 2, 3])) == [1, 2, 3]
assert encoder.default(dt(1917, 3, 8)) == "1917-03-08T00:00:00+00:00"
assert encoder.default(None) == "None"
for message in caplog.messages:
assert "cannot properly encode in JSON" in message