File: test_json.py

package info (click to toggle)
rich 13.9.4-1.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 20,284 kB
  • sloc: python: 29,157; makefile: 29
file content (8 lines) | stat: -rw-r--r-- 258 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
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}'