Coverage for tests/test_simple_title.py: 100%
13 statements
« prev ^ index » next coverage.py v7.6.1, created at 2026-10-15 15:22 +0000
« prev ^ index » next coverage.py v7.6.1, created at 2026-10-15 15:22 +0000
1import inspect 1ab
3import markdown 1ab
4from inline_snapshot import snapshot 1ab
5from mdx_include.mdx_include import IncludeExtension 1ab
7from markdown_include_variants import IncludeVariantsExtension 1ab
10def test_simple_title(): 1ab
11 input_md = inspect.cleandoc( 1cd
12 """
13 {*docs_src/simple/tutorial001.py title["Example 1"] *}
14 """
15 )
17 result = markdown.markdown(input_md, extensions=[IncludeVariantsExtension()]) 1cd
18 assert result == snapshot( 1cd
19 inspect.cleandoc(
20 """
21 <p>//// tab | Python 3.8+
22 <code>python title="Example 1"
23 {!docs_src/simple/tutorial001.py!}</code></p>
24 <p>////</p>
25 """
26 )
27 )
30def test_simple_include(): 1ab
31 input_md = inspect.cleandoc( 1ef
32 """
33 {* docs_src/simple/tutorial001.py title["Example 1"] *}
34 """
35 )
37 result = markdown.markdown( 1ef
38 input_md, extensions=[IncludeVariantsExtension(), IncludeExtension()]
39 )
40 assert result == snapshot( 1ef
41 inspect.cleandoc(
42 """
43 <p>//// tab | Python 3.8+
44 ```python title="Example 1"
45 print("simple line 1")
46 print("simple line 2")
47 print("simple line 3")
48 print("simple line 4")
49 print("simple line 5")
50 print("simple line 6")
51 print("simple line 7")
52 print("simple line 8")
53 print("simple line 9")
54 print("simple line 10")</p>
55 <p>```</p>
56 <p>////</p>
57 """
58 )
59 )