failed WRONG_FIX UNSUBMITTED wrong_fix_unsubmitted(None) · None tool calls · 0 s · Textualize/rich
fix superfluous space Fixes https://github.com/Textualize/rich/issues/3027
| # | Tool | Arguments | Result |
|---|---|---|---|
| No trace captured. | |||
--- a/rich/markdown.py
+++ b/rich/markdown.py
@@ -677,7 +677,7 @@ def __rich_console__(
and context.stack.top.on_child_close(context, element)
)
if should_render:
- if new_line:
+ if new_line and node_type != "inline":
yield _new_line_segment
yield from console.render(element, context.options)
.F
=================================== FAILURES ===================================
_______________________________ test_inline_code _______________________________
def test_inline_code():
markdown = Markdown(
"inline `import this` code",
inline_code_lexer="python",
inline_code_theme="emacs",
)
result = render(markdown)
expected = "inline \x1b[1;38;2;170;34;255;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 code \n"
print(result)
print(repr(result))
> assert result == expected
E AssertionError: assert 'inline \x1b[... \n' == 'inline \x1b[... \n'
E
E Skipping 51 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 code
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 code
E ? ^^^ ^^^ ^^^
tests/test_markdown.py:116: AssertionError
----------------------------- Captured stdout call -----------------------------
'inline \x1b[1;38;2;170;34;255;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 code \n'
inline [1;38;2;170;34;255;48;2;248;248;248mimport[0m[38;2;187;187;187;48;2;248;248;248m [0m[1;38;2;0;0;255;48;2;248;248;248mthis[0m code
'inline \x1b[1;38;2;170;34;255;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 code \n'
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
1 failed, 1 passed in 0.20s