← mined_oracle

rich_2538

failed WRONG_FIX UNSUBMITTED wrong_fix_unsubmitted(None) · None tool calls · 0 s · Textualize/rich

Task input

(not found in data/tasks.jsonl)

Tool calls (0)

#ToolArgumentsResult
No trace captured.

Patch

--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -22,8 +22,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 - Fix NO_COLOR support on legacy Windows https://github.com/Textualize/rich/pull/2458
 - Fix pretty printer handling of cyclic references https://github.com/Textualize/rich/pull/2524
 - Fix missing `mode` property on file wrapper breaking uploads via `requests` https://github.com/Textualize/rich/pull/2495
+- Fix mismatching default value of parameter `ensure_ascii` https://github.com/Textualize/rich/pull/2538
 - Remove unused height parameter in `Layout` class https://github.com/Textualize/rich/pull/2540
 
+
 ### Changed
 
 - Removed border from code blocks in Markdown
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -55,3 +55,4 @@ The following people have contributed to the development of Rich:
 - [Motahhar Mokfi](https://github.com/motahhar)
 - [Tomer Shalev](https://github.com/tomers)
 - [Serkan UYSAL](https://github.com/uysalserkan)
+- [Zhe Huang](https://github.com/onlyacat)
\ No newline at end of file
--- a/rich/__init__.py
+++ b/rich/__init__.py
@@ -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,
--- a/rich/console.py
+++ b/rich/console.py
@@ -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,
--- a/rich/json.py
+++ b/rich/json.py
@@ -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,

Test output

show
....................F
=================================== FAILURES ===================================
_______________________________ test_print_json ________________________________

    def test_print_json():
        console = Console(file=io.StringIO(), color_system="truecolor")
        console.print_json('[false, true, null, "foo"]', indent=4)
        result = console.file.getvalue()
        print(repr(result))
        expected = '\x1b[1m[\x1b[0m\n    \x1b[3;91mfalse\x1b[0m,\n    \x1b[3;92mtrue\x1b[0m,\n    \x1b[3;35mnull\x1b[0m,\n    \x1b[32m"foo"\x1b[0m\n\x1b[1m]\x1b[0m\n'
>       assert result == expected
E       AssertionError: assert '\x1b[1m[\x1b...[1m]\x1b[0m\n' == '\x1b[1m[\x1b...[1m]\x1b[0m\n'
E         
E           [
E         -     false,
E         ?        ---
E         +     false,
E         -     true,
E         ?        ---...
E         
E         ...Full output truncated (7 lines hidden), use '-vv' to show

tests/test_console.py:216: AssertionError
----------------------------- Captured stdout call -----------------------------
'\x1b[1m[\x1b[0m\n    \x1b[3mfalse\x1b[0m,\n    \x1b[3mtrue\x1b[0m,\n    \x1b[3mnull\x1b[0m,\n    "foo"\n\x1b[1m]\x1b[0m\n'
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
1 failed, 20 passed in 0.19s