mirror of
https://github.com/Textualize/rich.git
synced 2025-07-07 21:04:58 +00:00
8 lines
258 B
Python
8 lines
258 B
Python
from rich.json import JSON
|
|
import datetime
|
|
|
|
|
|
def test_print_json_data_with_default():
|
|
date = datetime.date(2021, 1, 1)
|
|
json = JSON.from_data({"date": date}, default=lambda d: d.isoformat())
|
|
assert str(json.text) == '{\n "date": "2021-01-01"\n}'
|