mirror of
https://github.com/Textualize/rich.git
synced 2025-08-04 18:18:22 +00:00
fix default ensure_ascii value to match docs.
This commit is contained in:
parent
bfea226da7
commit
32def19a2a
4 changed files with 11 additions and 4 deletions
|
@ -81,7 +81,7 @@ def print_json(
|
|||
indent: Union[None, int, str] = 2,
|
||||
highlight: bool = True,
|
||||
skip_keys: bool = False,
|
||||
ensure_ascii: bool = True,
|
||||
ensure_ascii: bool = False,
|
||||
check_circular: bool = True,
|
||||
allow_nan: bool = True,
|
||||
default: Optional[Callable[[Any], Any]] = None,
|
||||
|
|
|
@ -1722,7 +1722,7 @@ class Console:
|
|||
indent: Union[None, int, str] = 2,
|
||||
highlight: bool = True,
|
||||
skip_keys: bool = False,
|
||||
ensure_ascii: bool = True,
|
||||
ensure_ascii: bool = False,
|
||||
check_circular: bool = True,
|
||||
allow_nan: bool = True,
|
||||
default: Optional[Callable[[Any], Any]] = None,
|
||||
|
|
|
@ -27,7 +27,7 @@ class JSON:
|
|||
indent: Union[None, int, str] = 2,
|
||||
highlight: bool = True,
|
||||
skip_keys: bool = False,
|
||||
ensure_ascii: bool = True,
|
||||
ensure_ascii: bool = False,
|
||||
check_circular: bool = True,
|
||||
allow_nan: bool = True,
|
||||
default: Optional[Callable[[Any], Any]] = None,
|
||||
|
@ -56,7 +56,7 @@ class JSON:
|
|||
indent: Union[None, int, str] = 2,
|
||||
highlight: bool = True,
|
||||
skip_keys: bool = False,
|
||||
ensure_ascii: bool = True,
|
||||
ensure_ascii: bool = False,
|
||||
check_circular: bool = True,
|
||||
allow_nan: bool = True,
|
||||
default: Optional[Callable[[Any], Any]] = None,
|
||||
|
|
|
@ -239,6 +239,13 @@ def test_print_json_ensure_ascii():
|
|||
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_print_json_with_default_ensure_ascii():
|
||||
console = Console(file=io.StringIO(), color_system="truecolor")
|
||||
console.print_json(data={"foo": "💩"})
|
||||
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_print_json_indent_none():
|
||||
console = Console(file=io.StringIO(), color_system="truecolor")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue