Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 2 additions & 0 deletions blurb_it/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@


async def get_misc_news_filename(issue_number, section, body):
if " " in section:
raise ValueError(f"Use underscores not spaces in section name: {section}")
date = time.strftime("%Y-%m-%d-%H-%M-%S", time.localtime())
nonce = await nonceify(body)
path = f"Misc/NEWS.d/next/{section}/{date}.gh-issue-{issue_number}.{nonce}.rst"
Expand Down
4 changes: 2 additions & 2 deletions templates/add_blurb.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ <h3>📜🤖 Blurb it again?</h3>
<select id="section" name="section" class="form-control form-inline" required>
<option></option>
<option>Security</option>
<option>Core and Builtins</option>
<option>Core_and_Builtins</option>
Comment thread
hugovk marked this conversation as resolved.
Outdated
<option>Library</option>
<option>Documentation</option>
<option>Tests</option>
Expand All @@ -47,7 +47,7 @@ <h3>📜🤖 Blurb it again?</h3>
<option>macOS</option>
<option>IDLE</option>
<option>Tools-Demos</option>
Comment thread
hugovk marked this conversation as resolved.
Outdated
<option>C API</option>
<option>C_API</option>
Comment thread
hugovk marked this conversation as resolved.
Outdated
</select>
</div>
</div>
Expand Down
22 changes: 22 additions & 0 deletions tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,28 @@ async def test_get_misc_news_filename():
assert path.endswith(".gh-issue-123.Ps4kgC.rst")


async def test_get_misc_news_filename_sections_with_dashes():
path = await util.get_misc_news_filename(
issue_number=123,
section="Core_and_Builtins",
body="Lorem ipsum dolor amet flannel squid normcore tbh raclette enim",
)

assert path.startswith("Misc/NEWS.d/next/Core-and-Builtins/")


async def test_get_misc_news_filename_sections_with_space():
with pytest.raises(
ValueError,
match="Use underscores not spaces in section name: Core and Builtins",
):
await util.get_misc_news_filename(
issue_number=123,
section="Core and Builtins",
body="Lorem ipsum dolor amet flannel squid normcore tbh raclette enim",
)


async def test_has_session():
request = mock_request_session()

Expand Down