failed WRONG_FIX UNSUBMITTED wrong_fix_unsubmitted(None) · None tool calls · 0 s · Textualize/rich
fix for markdown table Fixes https://github.com/Textualize/rich/issues/3053
| # | Tool | Arguments | Result |
|---|---|---|---|
| No trace captured. | |||
--- a/rich/markdown.py
+++ b/rich/markdown.py
@@ -254,15 +254,14 @@ def __rich_console__(
) -> RenderResult:
table = Table(box=box.SIMPLE_HEAVY)
- assert self.header is not None
- assert self.header.row is not None
- for column in self.header.row.cells:
- table.add_column(column.content)
-
- assert self.body is not None
- for row in self.body.rows:
- row_content = [element.content for element in row.cells]
- table.add_row(*row_content)
+ if self.header is not None and self.header.row is not None:
+ for column in self.header.row.cells:
+ table.add_column(column.content)
+
+ if self.body is not None:
+ for row in self.body.rows:
+ row_content = [element.content for element in row.cells]
+ table.add_row(*row_content)
yield table
\x1b[0m\n\x1b[1;33m \x1b[0m\x1b[48;2;39;40;34m \x1b[0m\x1b[48;2;39;40;34mCode block \x1b[0m\x1b[48;2;39;40;34m \x1b[0m\n\x1b[1;33m \x1b[0m\x1b[48;2;39;40;34m \x1b[0m\n" > assert rendered_markdown == expected E AssertionError: assert '┏━━━━━━━━━━━... \n' == '┏━━━━━━━━━━━... \x1b[0m\n' E E Skipping 1211 identical leading characters in diff, use -v to show E - d[0m, [1;36;40mmonospace[0m. E ? ------ E + d[0m, [1mmonospace[0m. E E Horizontal rule: ... E E ...Full output truncated (85 lines hidden), use '-vv' to show tests/test_markdown.py:103: AssertionError ----------------------------- Captured stdout call ----------------------------- '┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\n┃ \x1b[1mHeading\x1b[0m ┃\n┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛\n\n\n \x1b[1;4mSub-heading\x1b[0m \n\n \x1b[1mHeading\x1b[0m \n\n \x1b[1;2mH4 Heading\x1b[0m \n\n \x1b[4mH5 Heading\x1b[0m \n\n \x1b[3mH6 Heading\x1b[0m \n\nParagraphs are separated by a blank line. \n\nTwo spaces at the end of a line \nproduces a line break. \n\nText attributes \x1b[3mitalic\x1b[0m, \x1b[1mbold\x1b[0m, \x1b[1mmonospace\x1b[0m. \n\nHorizontal rule: \n\n────────────────────────────────────────────────────────────────────────────────────────────────────\nBullet list: \n\n\x1b[1m • \x1b[0mapples \n\x1b[1m • \x1b[0moranges \n\x1b[1m • \x1b[0mpears \n\nNumbered list: \n\n\x1b[1m 1 \x1b[0mlather \n\x1b[1m 2 \x1b[0mrinse \n\x1b[1m 3 \x1b[0mrepeat \n\nAn \x1b]8;id=0;foo\x1b\\\x1b[4mexample\x1b[0m\x1b]8;;\x1b\\. \n\n▌ Markdown uses email-style > characters for blockquoting. \n▌ Lorem ipsum \n\n🌆 \x1b]8;id=0;foo\x1b\\progress\x1b]8;;\x1b\\ \n\n \n a=1 \n \n\n \n import this \n \n\n \n foobar \n \n\n \n import this \n \n\n\x1b[1m 1 \x1b[0mList item \n\x1b[1m \x1b[0m \n\x1b[1m \x1b[0m Code block \n\x1b[1m \x1b[0m \n' !!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!! 1 failed in 0.19s