File tree Expand file tree Collapse file tree 3 files changed +27
-3
lines changed
Expand file tree Collapse file tree 3 files changed +27
-3
lines changed Original file line number Diff line number Diff line change 99
1010
1111async def get_misc_news_filename (issue_number , section , body ):
12+ if " " in section :
13+ raise ValueError (f"Use underscores not spaces in section name: { section } " )
1214 date = time .strftime ("%Y-%m-%d-%H-%M-%S" , time .localtime ())
1315 nonce = await nonceify (body )
1416 path = f"Misc/NEWS.d/next/{ section } /{ date } .gh-issue-{ issue_number } .{ nonce } .rst"
Original file line number Diff line number Diff line change @@ -38,16 +38,16 @@ <h3>📜🤖 Blurb it again?</h3>
3838 < select id ="section " name ="section " class ="form-control form-inline " required >
3939 < option > </ option >
4040 < option > Security</ option >
41- < option > Core and Builtins</ option >
41+ < option value =" Core_and_Builtins " > Core and Builtins</ option >
4242 < option > Library</ option >
4343 < option > Documentation</ option >
4444 < option > Tests</ option >
4545 < option > Build</ option >
4646 < option > Windows</ option >
4747 < option > macOS</ option >
4848 < option > IDLE</ option >
49- < option > Tools-Demos</ option >
50- < option > C API</ option >
49+ < option value =" Tools-Demos " > Tools and Demos</ option >
50+ < option value =" C_API " > C API</ option >
5151 </ select >
5252 </ div >
5353 </ div >
Original file line number Diff line number Diff line change @@ -57,6 +57,28 @@ async def test_get_misc_news_filename():
5757 assert path .endswith (".gh-issue-123.Ps4kgC.rst" )
5858
5959
60+ async def test_get_misc_news_filename_sections_with_dashes ():
61+ path = await util .get_misc_news_filename (
62+ issue_number = 123 ,
63+ section = "Core_and_Builtins" ,
64+ body = "Lorem ipsum dolor amet flannel squid normcore tbh raclette enim" ,
65+ )
66+
67+ assert path .startswith ("Misc/NEWS.d/next/Core_and_Builtins/" )
68+
69+
70+ async def test_get_misc_news_filename_sections_with_space ():
71+ with pytest .raises (
72+ ValueError ,
73+ match = "Use underscores not spaces in section name: Core and Builtins" ,
74+ ):
75+ await util .get_misc_news_filename (
76+ issue_number = 123 ,
77+ section = "Core and Builtins" ,
78+ body = "Lorem ipsum dolor amet flannel squid normcore tbh raclette enim" ,
79+ )
80+
81+
6082async def test_has_session ():
6183 request = mock_request_session ()
6284
You can’t perform that action at this time.
0 commit comments