Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ The template for the `blurb add` message looks like this:
#.. section: Build
#.. section: Windows
#.. section: macOS
#.. section: iOS
#.. section: Android
#.. section: FreeBSD
#.. section: WASI
#.. section: Emscripten
#.. section: Unsupported platforms
#.. section: IDLE
#.. section: Tools/Demos
#.. section: C API
Expand Down
8 changes: 8 additions & 0 deletions src/blurb/_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
#.. section: Build
#.. section: Windows
#.. section: macOS
#.. section: iOS
#.. section: Android
#.. section: FreeBSD
#.. section: WASI
#.. section: Emscripten
#.. section: Unsupported platforms
#.. section: IDLE
#.. section: Tools/Demos
#.. section: C API
Expand All @@ -46,12 +52,14 @@
'C API': 'C_API',
'Core and Builtins': 'Core_and_Builtins',
'Tools/Demos': 'Tools-Demos',
'Unsupported platforms': 'Unsupported_platforms',
}

_unsanitize_section = {
'C_API': 'C API',
'Core_and_Builtins': 'Core and Builtins',
'Tools-Demos': 'Tools/Demos',
'Unsupported_platforms': 'Unsupported platforms',
}


Expand Down
14 changes: 12 additions & 2 deletions tests/test_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import blurb._template
from blurb._template import sanitize_section, unsanitize_section

UNCHANGED_SECTIONS = ('Library',)
UNCHANGED_SECTIONS = ('Library', 'iOS', 'FreeBSD', 'WASI')


def test_section_names():
Expand All @@ -16,6 +16,12 @@ def test_section_names():
'Build',
'Windows',
'macOS',
'iOS',
'Android',
'FreeBSD',
'WASI',
'Emscripten',
'Unsupported platforms',
'IDLE',
'Tools/Demos',
'C API',
Expand All @@ -34,6 +40,7 @@ def test_sanitize_section_no_change(section):
('C API', 'C_API'),
('Core and Builtins', 'Core_and_Builtins'),
('Tools/Demos', 'Tools-Demos'),
('Unsupported platforms', 'Unsupported_platforms'),
),
)
def test_sanitize_section_changed(section, expected):
Expand All @@ -49,7 +56,10 @@ def test_unsanitize_section_no_change(section):

@pytest.mark.parametrize(
'section, expected',
(('Tools-Demos', 'Tools/Demos'),),
(
('Tools-Demos', 'Tools/Demos'),
('Unsupported_platforms', 'Unsupported platforms'),
),
)
def test_unsanitize_section_changed(section, expected):
unsanitized = unsanitize_section(section)
Expand Down
15 changes: 11 additions & 4 deletions tests/test_utils_globs.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ def test_glob_blurbs_section_ordering(fs) -> None:
"""Sections must appear in importance order, not alphabetical order.

The canonical order is: Security, Core and Builtins, Library,
Documentation, Tests, Build, Windows, macOS, IDLE, Tools/Demos, C API.
Documentation, Tests, Build, Windows, macOS, iOS, Android, FreeBSD, WASI,
Emscripten, Unsupported platforms, IDLE, Tools/Demos, C API.
"""
# Arrange: one entry per section
fake_news_entries = [
Expand All @@ -76,9 +77,15 @@ def test_glob_blurbs_section_ordering(fs) -> None:
'Misc/NEWS.d/next/Build/2024-01-01-00-00-00.gh-issue-00005.fFFFFF.rst',
'Misc/NEWS.d/next/Windows/2024-01-01-00-00-00.gh-issue-00006.gGGGGG.rst',
'Misc/NEWS.d/next/macOS/2024-01-01-00-00-00.gh-issue-00007.hHHHHH.rst',
'Misc/NEWS.d/next/IDLE/2024-01-01-00-00-00.gh-issue-00008.iIIIII.rst',
'Misc/NEWS.d/next/Tools-Demos/2024-01-01-00-00-00.gh-issue-00009.jJJJJJ.rst',
'Misc/NEWS.d/next/C_API/2024-01-01-00-00-00.gh-issue-00010.kKKKKK.rst',
'Misc/NEWS.d/next/iOS/2024-01-01-00-00-00.gh-issue-00008.iIIIII.rst',
'Misc/NEWS.d/next/Android/2024-01-01-00-00-00.gh-issue-00009.jJJJJJ.rst',
'Misc/NEWS.d/next/FreeBSD/2024-01-01-00-00-00.gh-issue-00010.kKKKKK.rst',
'Misc/NEWS.d/next/WASI/2024-01-01-00-00-00.gh-issue-00011.lLLLLL.rst',
'Misc/NEWS.d/next/Emscripten/2024-01-01-00-00-00.gh-issue-00012.mMMMMM.rst',
'Misc/NEWS.d/next/Unsupported_platforms/2024-01-01-00-00-00.gh-issue-00013.nNNNNN.rst',
'Misc/NEWS.d/next/IDLE/2024-01-01-00-00-00.gh-issue-00014.oOOOOO.rst',
'Misc/NEWS.d/next/Tools-Demos/2024-01-01-00-00-00.gh-issue-00015.pPPPPP.rst',
'Misc/NEWS.d/next/C_API/2024-01-01-00-00-00.gh-issue-00016.qQQQQQ.rst',
]
for path in fake_news_entries:
fs.create_file(path)
Expand Down
Loading