← baseline_full_v2

rich_3718

failed NO_PATCH NO_PATCH UNSUBMITTED empty_patch(None) · None tool calls · 0 s · Textualize/rich

Task input

fix(panel): fix title missing panel background

 Fix `Panel` title missing the panel background style.
    
This really just reverts the change in 7a38204. There's a history of issues related to the panel title styles, so I was careful to run all the examples in those issues to ensure there wasn't any regression.
    
Fixes #3569

## Type of changes

- [x] Bug fix
- [ ] New feature
- [ ] Documentation / docstrings
- [ ] Tests
- [ ] Other

## Checklist

- [x] I've run the latest [black](https://github.com/psf/black) with default args on new code.
- [x] I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
- [x] I've added tests for new code.
- [x] I accept that @willmcgugan may be pedantic in the code review.

Tool calls (0)

#ToolArgumentsResult
No trace captured.

Test output

show
............F
=================================== FAILURES ===================================
____________________ test_title_text_with_panel_background _____________________

    def test_title_text_with_panel_background() -> None:
        """Regression test for https://github.com/Textualize/rich/issues/3569"""
        panel = Panel(
            "Hello, World",
            style="on blue",
            title=Text("title", style="red"),
            subtitle=Text("subtitle", style="magenta bold"),
        )
        console = Console(
            file=io.StringIO(),
            width=50,
            height=20,
            legacy_windows=False,
            force_terminal=True,
            color_system="truecolor",
        )
        console.print(panel)
    
        result = console.file.getvalue()
        print(repr(result))
        expected = "\x1b[44m╭─\x1b[0m\x1b[44m───────────────────\x1b[0m\x1b[31;44m title \x1b[0m\x1b[44m────────────────────\x1b[0m\x1b[44m─╮\x1b[0m\n\x1b[44m│\x1b[0m\x1b[44m \x1b[0m\x1b[44mHello, World\x1b[0m\x1b[44m                                  \x1b[0m\x1b[44m \x1b[0m\x1b[44m│\x1b[0m\n\x1b[44m╰─\x1b[0m\x1b[44m──────────────────\x1b[0m\x1b[1;35;44m subtitle \x1b[0m\x1b[44m──────────────────\x1b[0m\x1b[44m─╯\x1b[0m\n"
>       assert result == expected
E       AssertionError: assert '\x1b[44m╭─\x...4m─╯\x1b[0m\n' == '\x1b[44m╭─\x...4m─╯\x1b[0m\n'
E         
E         Skipping 33 identical leading characters in diff, use -v to show
E         - ── title ─────────────────────╮
E         ?           ---
E         + ── title ─────────────────────╮
E           │ Hello, World                                   │
E         - ╰─────────────────── subtitle ───────────────────╯
E         ?                                             ---
E         + ╰─────────────────── subtitle ───────────────────╯

tests/test_panel.py:172: AssertionError
----------------------------- Captured stdout call -----------------------------
'\x1b[44m╭─\x1b[0m\x1b[44m───────────────────\x1b[0m\x1b[31m title \x1b[0m\x1b[44m────────────────────\x1b[0m\x1b[44m─╮\x1b[0m\n\x1b[44m│\x1b[0m\x1b[44m \x1b[0m\x1b[44mHello, World\x1b[0m\x1b[44m                                  \x1b[0m\x1b[44m \x1b[0m\x1b[44m│\x1b[0m\n\x1b[44m╰─\x1b[0m\x1b[44m──────────────────\x1b[0m\x1b[1;35m subtitle \x1b[0m\x1b[44m──────────────────\x1b[0m\x1b[44m─╯\x1b[0m\n'
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
1 failed, 12 passed in 0.12s