Coverage for tests/test_another_preferred_variant.py: 100%

8 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2026-10-15 15:22 +0000

1import inspect 1ab

2 

3import markdown 1ab

4from inline_snapshot import snapshot 1ab

5 

6from markdown_include_variants import IncludeVariantsExtension 1ab

7 

8 

9def test_all_variants_plain(): 1ab

10 input_md = inspect.cleandoc( 1cd

11 """ 

12 {* docs_src/all_variants/tutorial001_an_py39.py *} 

13 """ 

14 ) 

15 

16 result = markdown.markdown(input_md, extensions=[IncludeVariantsExtension()]) 1cd

17 assert result == snapshot( 1cd

18 inspect.cleandoc( 

19 """ 

20 <p>//// tab | Python 3.9+ 

21 <code>python 

22 {!docs_src/all_variants/tutorial001_an_py39.py!}</code></p> 

23 <p>////</p> 

24 <p>///// details | 🤓 Other versions and variants</p> 

25 <p>//// tab | Python 3.11+</p> 

26 <p><code>python 

27 {!docs_src/all_variants/tutorial001_an_py311.py!}</code> 

28 //// 

29 //// tab | Python 3.10+</p> 

30 <p><code>python 

31 {!docs_src/all_variants/tutorial001_an_py310.py!}</code> 

32 //// 

33 //// tab | Python 3.8+</p> 

34 <p><code>python 

35 {!docs_src/all_variants/tutorial001_an.py!}</code> 

36 //// 

37 //// tab | Python 3.11+ - non-Annotated</p> 

38 <p>/// tip</p> 

39 <p>Prefer to use the <code>Annotated</code> version if possible.</p> 

40 <p>///</p> 

41 <p><code>python 

42 {!docs_src/all_variants/tutorial001_py311.py!}</code> 

43 //// 

44 //// tab | Python 3.10+ - non-Annotated</p> 

45 <p>/// tip</p> 

46 <p>Prefer to use the <code>Annotated</code> version if possible.</p> 

47 <p>///</p> 

48 <p><code>python 

49 {!docs_src/all_variants/tutorial001_py310.py!}</code> 

50 //// 

51 //// tab | Python 3.9+ - non-Annotated</p> 

52 <p>/// tip</p> 

53 <p>Prefer to use the <code>Annotated</code> version if possible.</p> 

54 <p>///</p> 

55 <p><code>python 

56 {!docs_src/all_variants/tutorial001_py39.py!}</code> 

57 //// 

58 //// tab | Python 3.8+ - non-Annotated</p> 

59 <p>/// tip</p> 

60 <p>Prefer to use the <code>Annotated</code> version if possible.</p> 

61 <p>///</p> 

62 <p><code>python 

63 {!docs_src/all_variants/tutorial001.py!}</code> 

64 ////</p> 

65 <p>/////</p> 

66 """ 

67 ) 

68 )