mirror of
https://github.com/langchain-ai/markdown-exec.git
synced 2026-07-25 05:15:22 -04:00
42 lines
868 B
Python
42 lines
868 B
Python
"""Tests for the `python` module."""
|
|
|
|
from textwrap import dedent
|
|
|
|
from markdown import Markdown
|
|
|
|
|
|
def test_output_markdown(md: Markdown) -> None:
|
|
"""Assert Markdown is converted to HTML.
|
|
|
|
Parameters:
|
|
md: A Markdown instance (fixture).
|
|
"""
|
|
html = md.convert(
|
|
dedent(
|
|
"""
|
|
```python exec="yes"
|
|
output_markdown("**Bold!**")
|
|
```
|
|
"""
|
|
)
|
|
)
|
|
assert html == "<p><strong>Bold!</strong></p>"
|
|
|
|
|
|
def test_output_html(md: Markdown) -> None:
|
|
"""Assert HTML is injected as is.
|
|
|
|
Parameters:
|
|
md: A Markdown instance (fixture).
|
|
"""
|
|
html = md.convert(
|
|
dedent(
|
|
"""
|
|
```python exec="yes"
|
|
output_html("**Bold!**")
|
|
```
|
|
"""
|
|
)
|
|
)
|
|
assert html == '<div markdown="0">**Bold!**</div>'
|