failed WRONG_FIX UNSUBMITTED wrong_fix_unsubmitted(None) · None tool calls · 0 s · Textualize/rich
Inline table code Fixes https://github.com/Textualize/rich/issues/4038
| # | Tool | Arguments | Result |
|---|---|---|---|
| No trace captured. | |||
--- a/rich/markdown.py
+++ b/rich/markdown.py
@@ -331,9 +331,10 @@ def __init__(self, justify: JustifyMethod) -> None:
self.justify = justify
def on_text(self, context: MarkdownContext, text: TextType) -> None:
- text = Text(text) if isinstance(text, str) else text
- text.stylize(context.current_style)
- self.content.append_text(text)
+ if isinstance(text, str):
+ self.content.append(text, context.current_style)
+ else:
+ self.content.append_text(text)
class ListElement(MarkdownElement):.......F
=================================== FAILURES ===================================
_______________________ test_inline_code_in_table_cells ________________________
def test_inline_code_in_table_cells() -> None:
"""Test inline code in table cells.
Regression test for https://github.com/Textualize/rich/issues/4038
"""
markdown = Markdown(
"| Col |\n|---|\n| `print('hello');` |\n",
inline_code_theme="monokai",
inline_code_lexer="python",
)
result = render(markdown)
expected = "\n\x1b[36m \x1b[0m\n\x1b[36m \x1b[0m\x1b[36mCol\x1b[0m\x1b[1m \x1b[0m\x1b[36m \x1b[0m\n\x1b[36m ─────────────── \x1b[0m\n\x1b[36m \x1b[0m\x1b[38;2;248;248;242;48;2;39;40;34mprint\x1b[0m\x1b[38;2;248;248;242;48;2;39;40;34m(\x1b[0m\x1b[38;2;230;219;116;48;2;39;40;34m'\x1b[0m\x1b[38;2;230;219;116;48;2;39;40;34mhello\x1b[0m\x1b[38;2;230;219;116;48;2;39;40;34m'\x1b[0m\x1b[38;2;248;248;242;48;2;39;40;34m)\x1b[0m\x1b[38;2;248;248;242;48;2;39;40;34m;\x1b[0m\x1b[36m \x1b[0m\n\x1b[36m \x1b[0m\n"
> assert result == expected
E AssertionError: assert '\n\x1b[36m ... \x1b[0m\n' == '\n\x1b[36m ... \x1b[0m\n'
E
E Skipping 115 identical leading characters in diff, use -v to show
E - [0m[38;2;248;248;242;48;2;39;40;34mprint[0m[38;2;248;248;242;48;2;39;40;34m([0m[38;2;230;219;116;48;2;39;40;34m'[0m[38;2;230;219;116;48;2;39;40;34mhello[0m[38;2;230;219;116;48;2;39;40;34m'[0m[38;2;248;248;242;48;2;39;40;34m)[0m[38;2;248;248;242;48;2;39;40;34m;[0m[36m [0m
E ? ^^^^^^^^^^^
E + [0m[38;2;166;226;46;48;2;39;40;34mprint[0m[38;2;248;248;242;48;2;39;40;34m([0m[38;2;230;219;116;48;2;39;40;34m'[0m[38;2;230;219;116;48;2;39;40;34mhello[0m[38;2;230;219;116;48;2;39;40;34m'...
E
E ...Full output truncated (3 lines hidden), use '-vv' to show
tests/test_markdown.py:215: AssertionError
----------------------------- Captured stdout call -----------------------------
"\n\x1b[36m \x1b[0m\n\x1b[36m \x1b[0m\x1b[36mCol\x1b[0m\x1b[1m \x1b[0m\x1b[36m \x1b[0m\n\x1b[36m ─────────────── \x1b[0m\n\x1b[36m \x1b[0m\x1b[38;2;166;226;46;48;2;39;40;34mprint\x1b[0m\x1b[38;2;248;248;242;48;2;39;40;34m(\x1b[0m\x1b[38;2;230;219;116;48;2;39;40;34m'\x1b[0m\x1b[38;2;230;219;116;48;2;39;40;34mhello\x1b[0m\x1b[38;2;230;219;116;48;2;39;40;34m'\x1b[0m\x1b[38;2;248;248;242;48;2;39;40;34m)\x1b[0m\x1b[38;2;248;248;242;48;2;39;40;34m;\x1b[0m\x1b[36m \x1b[0m\n\x1b[36m \x1b[0m\n"
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
1 failed, 7 passed in 0.17s