Skip to content

Commit

Permalink
Add test for markdown tables
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenburns committed May 31, 2023
1 parent 5c8250a commit c40fdbb
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions tests/test_markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,17 +119,17 @@ def test_inline_code():
def test_markdown_table():
markdown = Markdown(
"""\
| Year | Title | Director | Box Office (USD) |
|------|:------------------------------------------------:|:------------------|------------------:|
| 1982 | E.T. the Extra-Terrestrial | Steven Spielberg | $792.9 million |
| 1980 | Star Wars: Episode V – The Empire Strikes Back | Irvin Kershner | $538.4 million |
| 1983 | Star Wars: Episode VI – Return of the Jedi | Richard Marquand | $475.1 million |
| 1981 | Raiders of the Lost Ark | Steven Spielberg | $389.9 million |
| 1984 | Indiana Jones and the Temple of Doom | Steven Spielberg | $333.1 million |
"""
| Year | Title | Director | Box Office (USD) |
|------|:------------------------------------------------:|:------------------|------------------:|
| 1982 | E.T. the Extra-Terrestrial | Steven Spielberg | $792.9 million |
| 1980 | Star Wars: Episode V – The Empire Strikes Back | Irvin Kershner | $538.4 million |
| 1983 | Star Wars: Episode VI – Return of the Jedi | Richard Marquand | $475.1 million |
| 1981 | Raiders of the Lost Ark | Steven Spielberg | $389.9 million |
| 1984 | Indiana Jones and the Temple of Doom | Steven Spielberg | $333.1 million |
"""
)
result = render(markdown)
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"
expected = "\n┏━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓\n\x1b[1m \x1b[0m\x1b[1mYear\x1b[0m\x1b[1m \x1b[0m┃\x1b[1m \x1b[0m\x1b[1m Title \x1b[0m\x1b[1m \x1b[0m┃\x1b[1m \x1b[0m\x1b[1mDirector \x1b[0m\x1b[1m \x1b[0m┃\x1b[1m \x1b[0m\x1b[1mBox Office (USD)\x1b[0m\x1b[1m \x1b[0m┃\n┡━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩\n│ 1982 │ E.T. the Extra-Terrestrial │ Steven Spielberg │ $792.9 million │\n│ 1980 │ Star Wars: Episode V – The Empire Strikes Back │ Irvin Kershner │ $538.4 million │\n│ 1983 │ Star Wars: Episode VI – Return of the Jedi │ Richard Marquand │ $475.1 million │\n│ 1981 │ Raiders of the Lost Ark │ Steven Spielberg │ $389.9 million │\n│ 1984 │ Indiana Jones and the Temple of Doom │ Steven Spielberg │ $333.1 million │\n└──────┴────────────────────────────────────────────────┴──────────────────┴──────────────────┘\n"
assert result == expected


Expand Down

0 comments on commit c40fdbb

Please sign in to comment.