File size: 258 Bytes
065fee7
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
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}'