mirror of https://github.com/Textualize/rich.git
pass dumps params
This commit is contained in:
parent
8cf9b684f3
commit
5d601fabc3
|
@ -1668,7 +1668,17 @@ class Console:
|
|||
raise TypeError(
|
||||
f"json must be str. Did you mean print_json(data={json!r}) ?"
|
||||
)
|
||||
json_renderable = JSON(json, indent=indent, highlight=highlight)
|
||||
json_renderable = JSON(
|
||||
json,
|
||||
indent=indent,
|
||||
highlight=highlight,
|
||||
skip_keys=skip_keys,
|
||||
ensure_ascii=ensure_ascii,
|
||||
check_circular=check_circular,
|
||||
allow_nan=allow_nan,
|
||||
default=default,
|
||||
sort_keys=sort_keys,
|
||||
)
|
||||
self.print(json_renderable)
|
||||
|
||||
def update_screen(
|
||||
|
|
|
@ -141,6 +141,15 @@ def test_print_json_data():
|
|||
assert result == expected
|
||||
|
||||
|
||||
def test_print_json_ensure_ascii():
|
||||
console = Console(file=io.StringIO(), color_system="truecolor")
|
||||
console.print_json(data={"foo": "💩"}, ensure_ascii=False)
|
||||
result = console.file.getvalue()
|
||||
print(repr(result))
|
||||
expected = '\x1b[1m{\x1b[0m\n \x1b[1;34m"foo"\x1b[0m: \x1b[32m"💩"\x1b[0m\n\x1b[1m}\x1b[0m\n'
|
||||
assert result == expected
|
||||
|
||||
|
||||
def test_log():
|
||||
console = Console(
|
||||
file=io.StringIO(),
|
||||
|
|
Loading…
Reference in New Issue