Skip to content

Commit

Permalink
Fix test_compiling_markdown[mdx podcast] test failure on Python 3.11
Browse files Browse the repository at this point in the history
The previous output was incorrect. Markdown 3.5 now defers to Python
for the empty tag list, and the `<source>` tag was added to the empty
tag list in Python 3.11.
  • Loading branch information
Kwpolska committed Oct 8, 2023
1 parent d2c752c commit e333da4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/test_compile_markdown.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import io
import sys
from os import path

import pytest
Expand All @@ -8,13 +9,17 @@
from .helper import FakeSite


# The <source> tag should not have a closing tag, but it wasn't included in xml.etree.ElementTree.HTML_EMPTY before Python 3.11
SOURCE_CLOSE_TAG = '</source>' if sys.version_info < (3, 11) else ''


@pytest.mark.parametrize(
"input_str, expected_output",
[
pytest.param("", "", id="empty"),
pytest.param(
"[podcast]https://archive.org/download/Rebeldes_Stereotipos/rs20120609_1.mp3[/podcast]",
'<p><audio controls=""><source src="https://archive.org/download/Rebeldes_Stereotipos/rs20120609_1.mp3" type="audio/mpeg"></source></audio></p>',
'<p><audio controls=""><source src="https://archive.org/download/Rebeldes_Stereotipos/rs20120609_1.mp3" type="audio/mpeg">' + SOURCE_CLOSE_TAG + '</audio></p>',
id="mdx podcast",
),
pytest.param(
Expand Down

0 comments on commit e333da4

Please sign in to comment.