1+ import pytest
12import blurb ._template
3+ from blurb ._template import sanitize_section , unsanitize_section
4+
5+ UNCHANGED_SECTIONS = (
6+ "Library" ,
7+ )
28
39
410def test_section_names ():
@@ -15,3 +21,39 @@ def test_section_names():
1521 'Tools/Demos' ,
1622 'C API' ,
1723 )
24+
25+
26+ @pytest .mark .parametrize ("section" , UNCHANGED_SECTIONS )
27+ def test_sanitize_section_no_change (section ):
28+ sanitized = sanitize_section (section )
29+ assert sanitized == section
30+
31+
32+ @pytest .mark .parametrize (
33+ "section, expected" ,
34+ (
35+ ("C API" , "C_API" ),
36+ ("Core and Builtins" , "Core_and_Builtins" ),
37+ ("Tools/Demos" , "Tools-Demos" ),
38+ ),
39+ )
40+ def test_sanitize_section_changed (section , expected ):
41+ sanitized = sanitize_section (section )
42+ assert sanitized == expected
43+
44+
45+ @pytest .mark .parametrize ("section" , UNCHANGED_SECTIONS )
46+ def test_unsanitize_section_no_change (section ):
47+ unsanitized = unsanitize_section (section )
48+ assert unsanitized == section
49+
50+
51+ @pytest .mark .parametrize (
52+ "section, expected" ,
53+ (
54+ ("Tools-Demos" , "Tools/Demos" ),
55+ ),
56+ )
57+ def test_unsanitize_section_changed (section , expected ):
58+ unsanitized = unsanitize_section (section )
59+ assert unsanitized == expected
0 commit comments