failed WRONG_FIX UNSUBMITTED wrong_fix_unsubmitted(None) · None tool calls · 0 s · Textualize/rich
fix(syntax): include padding with background color override ## 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. ## Description Fixes #3295. I've tested manually but I'm afraid not sure how to add a proper test for this. #### Before:  #### After: 
| # | Tool | Arguments | Result |
|---|---|---|---|
| No trace captured. | |||
--- a/rich/syntax.py
+++ b/rich/syntax.py
@@ -619,9 +619,7 @@ def __rich_console__(
) -> RenderResult:
segments = Segments(self._get_syntax(console, options))
if self.padding:
- yield Padding(
- segments, style=self._theme.get_background_style(), pad=self.padding
- )
+ yield Padding(segments, style=self._get_base_style(), pad=self.padding)
else:
yield segments
F
=================================== FAILURES ===================================
_______________________________ test_blank_lines _______________________________
def test_blank_lines():
code = "\n\nimport this\n\n"
syntax = Syntax(
code, lexer="python", theme="ascii_light", code_width=30, line_numbers=True
)
result = render(syntax)
print(repr(result))
> assert (
result
== "\x1b[1;38;2;24;24;24;48;2;248;248;248m \x1b[0m\x1b[38;2;173;173;173;48;2;248;248;248m1 \x1b[0m\x1b[48;2;248;248;248m \x1b[0m\n\x1b[1;38;2;24;24;24;48;2;248;248;248m \x1b[0m\x1b[38;2;173;173;173;48;2;248;248;248m2 \x1b[0m\x1b[48;2;248;248;248m \x1b[0m\n\x1b[1;38;2;24;24;24;48;2;248;248;248m \x1b[0m\x1b[38;2;173;173;173;48;2;248;248;248m3 \x1b[0m\x1b[1;38;2;0;128;0;48;2;248;248;248mimport\x1b[0m\x1b[38;2;0;0;0;48;2;248;248;248m \x1b[0m\x1b[1;38;2;0;0;255;48;2;248;248;248mthis\x1b[0m\x1b[48;2;248;248;248m \x1b[0m\n\x1b[1;38;2;24;24;24;48;2;248;248;248m \x1b[0m\x1b[38;2;173;173;173;48;2;248;248;248m4 \x1b[0m\x1b[48;2;248;248;248m \x1b[0m\n\x1b[1;38;2;24;24;24;48;2;248;248;248m \x1b[0m\x1b[38;2;173;173;173;48;2;248;248;248m5 \x1b[0m\x1b[48;2;248;248;248m \x1b[0m\n"
)
E AssertionError: assert '\x1b[1;38;2;... \x1b[0m\n' == '\x1b[1;38;2;... \x1b[0m\n'
E
E Skipping 398 identical leading characters in diff, use -v to show
E - [0m[38;2;0;0;0;48;2;248;248;248m [0m[1;38;2;0;0;255;48;2;248;248;248mthis[0m[48;2;248;248;248m [0m
E ? ^ ^ ^
E + [0m[38;2;187;187;187;48;2;248;248;248m [0m[1;38;2;0;0;255;48;2;248;248;248mthis[0m[48;2;248;248;248m [0m
E ? ^^^ ^^^ ^^^
E [1;38;2;24;24;24;48;2;248;248;248m [0m[38;2;173;173;173;48;2;248;248;248m4 [0m[48;2;248;248;248m [0m
E [1;38;2;24;24;24;48;2;248;248;248m [0m[38;2;173;173;173;48;2;248;248;248m5 [0m[48;2;248;248;248m [0m
tests/test_syntax.py:54: AssertionError
----------------------------- Captured stdout call -----------------------------
'\x1b[1;38;2;24;24;24;48;2;248;248;248m \x1b[0m\x1b[38;2;173;173;173;48;2;248;248;248m1 \x1b[0m\x1b[48;2;248;248;248m \x1b[0m\n\x1b[1;38;2;24;24;24;48;2;248;248;248m \x1b[0m\x1b[38;2;173;173;173;48;2;248;248;248m2 \x1b[0m\x1b[48;2;248;248;248m \x1b[0m\n\x1b[1;38;2;24;24;24;48;2;248;248;248m \x1b[0m\x1b[38;2;173;173;173;48;2;248;248;248m3 \x1b[0m\x1b[1;38;2;0;128;0;48;2;248;248;248mimport\x1b[0m\x1b[38;2;187;187;187;48;2;248;248;248m \x1b[0m\x1b[1;38;2;0;0;255;48;2;248;248;248mthis\x1b[0m\x1b[48;2;248;248;248m \x1b[0m\n\x1b[1;38;2;24;24;24;48;2;248;248;248m \x1b[0m\x1b[38;2;173;173;173;48;2;248;248;248m4 \x1b[0m\x1b[48;2;248;248;248m \x1b[0m\n\x1b[1;38;2;24;24;24;48;2;248;248;248m \x1b[0m\x1b[38;2;173;173;173;48;2;248;248;248m5 \x1b[0m\x1b[48;2;248;248;248m \x1b[0m\n'
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
1 failed in 0.17s