Skip to content

Commit 5c8250a

Browse files
committed
Add test for Markdown tables
1 parent 480ea6b commit 5c8250a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/test_markdown.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,23 @@ def test_inline_code():
116116
assert result == expected
117117

118118

119+
def test_markdown_table():
120+
markdown = Markdown(
121+
"""\
122+
| Year | Title | Director | Box Office (USD) |
123+
|------|:------------------------------------------------:|:------------------|------------------:|
124+
| 1982 | E.T. the Extra-Terrestrial | Steven Spielberg | $792.9 million |
125+
| 1980 | Star Wars: Episode V – The Empire Strikes Back | Irvin Kershner | $538.4 million |
126+
| 1983 | Star Wars: Episode VI – Return of the Jedi | Richard Marquand | $475.1 million |
127+
| 1981 | Raiders of the Lost Ark | Steven Spielberg | $389.9 million |
128+
| 1984 | Indiana Jones and the Temple of Doom | Steven Spielberg | $333.1 million |
129+
"""
130+
)
131+
result = render(markdown)
132+
expected = "\x1b[48;2;39;40;34m \x1b[0m\n\x1b[48;2;39;40;34m \x1b[0m\x1b[48;2;39;40;34m| Year | Title | Director | Box Office (USD) \x1b[0m\x1b[48;2;39;40;34m \x1b[0m\n\x1b[48;2;39;40;34m \x1b[0m\x1b[48;2;39;40;34m|------|:------------------------------------------------:|:------------------|------------------:\x1b[0m\x1b[48;2;39;40;34m \x1b[0m\n\x1b[48;2;39;40;34m \x1b[0m\x1b[48;2;39;40;34m| 1982 | E.T. the Extra-Terrestrial | Steven Spielberg | $792.9 million \x1b[0m\x1b[48;2;39;40;34m \x1b[0m\n\x1b[48;2;39;40;34m \x1b[0m\x1b[48;2;39;40;34m| 1980 | Star Wars: Episode V – The Empire Strikes Back | Irvin Kershner | $538.4 million \x1b[0m\x1b[48;2;39;40;34m \x1b[0m\n\x1b[48;2;39;40;34m \x1b[0m\x1b[48;2;39;40;34m| 1983 | Star Wars: Episode VI – Return of the Jedi | Richard Marquand | $475.1 million \x1b[0m\x1b[48;2;39;40;34m \x1b[0m\n\x1b[48;2;39;40;34m \x1b[0m\x1b[48;2;39;40;34m| 1981 | Raiders of the Lost Ark | Steven Spielberg | $389.9 million \x1b[0m\x1b[48;2;39;40;34m \x1b[0m\n\x1b[48;2;39;40;34m \x1b[0m\x1b[48;2;39;40;34m| 1984 | Indiana Jones and the Temple of Doom | Steven Spielberg | $333.1 million \x1b[0m\x1b[48;2;39;40;34m \x1b[0m\n\x1b[48;2;39;40;34m \x1b[0m\n"
133+
assert result == expected
134+
135+
119136
if __name__ == "__main__":
120137
markdown = Markdown(MARKDOWN)
121138
rendered = render(markdown)

0 commit comments

Comments
 (0)