← pod_r5_v1i

rich_3934

failed WRONG_FIX wrong_fix · 53 tool calls · 0 s · Textualize/rich

Task input

empty live

Fixes https://github.com/Textualize/rich/issues/3796

Tool calls (0)

#ToolArgumentsResult
No trace captured.

Patch

diff --git a/output.txt b/output.txt
new file mode 100644
index 00000000..e965047a
--- /dev/null
+++ b/output.txt
@@ -0,0 +1 @@
+Hello
diff --git a/reproduce_issue.py b/reproduce_issue.py
new file mode 100644
index 00000000..5dbfa2ed
--- /dev/null
+++ b/reproduce_issue.py
@@ -0,0 +1,9 @@
+from rich.live import Live
+from rich.console import Console
+
+console = Console()
+live = Live(None, console=console)
+live.update("Hello")
+# Now we want to see if it's updated in _live_render WITHOUT calling refresh().
+# But wait, update() doesn't call _live_render.set_renderable() unless refresh=True.
+print(f"Renderable in _live_render: {repr(live._live_render.renderable)}")

Test output

show
..........F
=================================== FAILURES ===================================
_______________________________ test_live_empty ________________________________

    def test_live_empty() -> None:
        """Regression test for https://github.com/Textualize/rich/issues/3796
    
        No NL should be written if there was nothing rendered.
        """
    
        from rich.console import Group
    
        console = create_capture_console(width=20, height=5)
        console.begin_capture()
        with Live(Group(), console=console, transient=True):
            pass
        result = console.end_capture()
        print(repr(result))
>       assert "\n" not in result
E       AssertionError: assert '\n' not in '\x1b[?25l\r...n\x1b[?25h\r'
E         
E         '\n' is contained here:
E           [?25l
E           
E         ? ----
E           [?25h

tests/test_live.py:186: AssertionError
----------------------------- Captured stdout call -----------------------------
'\x1b[?25l\r\x1b[2K\n\x1b[?25h\r'
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
1 failed, 10 passed in 2.22s