5
5
6
6
7
7
UNCHANGED_SECTIONS = (
8
- "C API" ,
9
- "Core and Builtins" ,
10
8
"Library" ,
11
9
)
12
10
13
11
14
12
@pytest .mark .parametrize ("section" , UNCHANGED_SECTIONS )
15
- def test_sanitize_section_no_change (section : str ) -> None :
13
+ def test_sanitize_section_no_change (section ) :
16
14
sanitized = blurb .sanitize_section (section )
17
15
assert sanitized == section
18
16
19
17
20
18
@pytest .mark .parametrize (
21
19
"section, expected" ,
22
20
(
21
+ ("C API" , "C_API" ),
22
+ ("Core and Builtins" , "Core_and_Builtins" ),
23
23
("Tools/Demos" , "Tools-Demos" ),
24
24
),
25
25
)
26
- def test_sanitize_section_changed (section : str , expected : str ) -> None :
26
+ def test_sanitize_section_changed (section , expected ) :
27
27
sanitized = blurb .sanitize_section (section )
28
28
assert sanitized == expected
29
29
30
30
31
31
@pytest .mark .parametrize ("section" , UNCHANGED_SECTIONS )
32
- def test_unsanitize_section_no_change (section : str ) -> None :
32
+ def test_unsanitize_section_no_change (section ) :
33
33
unsanitized = blurb .unsanitize_section (section )
34
34
assert unsanitized == section
35
35
@@ -40,12 +40,12 @@ def test_unsanitize_section_no_change(section: str) -> None:
40
40
("Tools-Demos" , "Tools/Demos" ),
41
41
),
42
42
)
43
- def test_unsanitize_section_changed (section : str , expected : str ) -> None :
43
+ def test_unsanitize_section_changed (section , expected ) :
44
44
unsanitized = blurb .unsanitize_section (section )
45
45
assert unsanitized == expected
46
46
47
47
48
- def test_glob_blurbs_next (fs : FakeFilesystem ) -> None :
48
+ def test_glob_blurbs_next (fs ) :
49
49
# Arrange
50
50
fake_news_entries = (
51
51
"Misc/NEWS.d/next/Library/2022-04-11-18-34-33.gh-issue-11111.pC7gnM.rst" ,
@@ -69,28 +69,71 @@ def test_glob_blurbs_next(fs: FakeFilesystem) -> None:
69
69
assert set (filenames ) == set (fake_news_entries )
70
70
71
71
72
+ def test_glob_blurbs_sort_order (fs ):
73
+ """
74
+ It shouldn't make a difference to sorting whether
75
+ section names have spaces or underscores.
76
+ """
77
+ # Arrange
78
+ fake_news_entries = (
79
+ "Misc/NEWS.d/next/Core and Builtins/2023-07-23-12-01-00.gh-issue-33331.Pf_BI1.rst" ,
80
+ "Misc/NEWS.d/next/Core_and_Builtins/2023-07-23-12-02-00.gh-issue-33332.Pf_BI2.rst" ,
81
+ "Misc/NEWS.d/next/Core and Builtins/2023-07-23-12-03-00.gh-issue-33333.Pf_BI3.rst" ,
82
+ "Misc/NEWS.d/next/Core_and_Builtins/2023-07-23-12-04-00.gh-issue-33334.Pf_BI4.rst" ,
83
+ )
84
+ # As fake_news_entries, but reverse sorted by *filename* only
85
+ expected = [
86
+ "Misc/NEWS.d/next/Core_and_Builtins/2023-07-23-12-04-00.gh-issue-33334.Pf_BI4.rst" ,
87
+ "Misc/NEWS.d/next/Core and Builtins/2023-07-23-12-03-00.gh-issue-33333.Pf_BI3.rst" ,
88
+ "Misc/NEWS.d/next/Core_and_Builtins/2023-07-23-12-02-00.gh-issue-33332.Pf_BI2.rst" ,
89
+ "Misc/NEWS.d/next/Core and Builtins/2023-07-23-12-01-00.gh-issue-33331.Pf_BI1.rst" ,
90
+ ]
91
+ fake_readmes = (
92
+ "Misc/NEWS.d/next/Library/README.rst" ,
93
+ "Misc/NEWS.d/next/Core and Builtins/README.rst" ,
94
+ "Misc/NEWS.d/next/Tools-Demos/README.rst" ,
95
+ "Misc/NEWS.d/next/C API/README.rst" ,
96
+ )
97
+ for fn in fake_news_entries + fake_readmes :
98
+ fs .create_file (fn )
99
+
100
+ # Act
101
+ filenames = blurb .glob_blurbs ("next" )
102
+
103
+ # Assert
104
+ assert filenames == expected
105
+
106
+
72
107
@pytest .mark .parametrize (
73
108
"news_entry, expected_section" ,
74
109
(
75
110
(
76
- "Misc/NEWS.d/next/Library/2022-04-11-18-34-33.gh-issue-55555 .pC7gnM.rst" ,
111
+ "Misc/NEWS.d/next/Library/2022-04-11-18-34-33.gh-issue-33333 .pC7gnM.rst" ,
77
112
"Library" ,
78
113
),
79
114
(
80
- "Misc/NEWS.d/next/Core and Builtins/2023-03-17-12-09-45.gh-issue-33333.Pf_BI7.rst" ,
115
+ "Misc/NEWS.d/next/Core_and_Builtins/2023-03-17-12-09-45.gh-issue-44444.Pf_BI7.rst" ,
116
+ "Core and Builtins" ,
117
+ ),
118
+ (
119
+ "Misc/NEWS.d/next/Core and Builtins/2023-03-17-12-09-45.gh-issue-55555.Pf_BI7.rst" ,
81
120
"Core and Builtins" ,
82
121
),
83
122
(
84
- "Misc/NEWS.d/next/Tools-Demos/2023-03-21-01-27-07.gh-issue-44444 .2F1Byz.rst" ,
123
+ "Misc/NEWS.d/next/Tools-Demos/2023-03-21-01-27-07.gh-issue-66666 .2F1Byz.rst" ,
85
124
"Tools/Demos" ,
86
125
),
87
126
(
88
- "Misc/NEWS.d/next/C API/2023-03-27-22-09-07.gh-issue-66666.3SN8Bs.rst" ,
127
+ "Misc/NEWS.d/next/C_API/2023-03-27-22-09-07.gh-issue-77777.3SN8Bs.rst" ,
128
+ "C API" ,
129
+ ),
130
+ (
131
+ "Misc/NEWS.d/next/C API/2023-03-27-22-09-07.gh-issue-88888.3SN8Bs.rst" ,
89
132
"C API" ,
90
133
),
91
134
),
92
135
)
93
- def test_load_next (news_entry : str , expected_section : str , fs : FakeFilesystem ) -> None :
136
+ def test_load_next (news_entry , expected_section , fs ) :
94
137
# Arrange
95
138
fs .create_file (news_entry , contents = "testing" )
96
139
blurbs = blurb .Blurbs ()
@@ -107,26 +150,24 @@ def test_load_next(news_entry: str, expected_section: str, fs: FakeFilesystem) -
107
150
"news_entry, expected_path" ,
108
151
(
109
152
(
110
- "Misc/NEWS.d/next/Library/2022-04-11-18-34-33.gh-issue-55555 .pC7gnM.rst" ,
111
- "root/Misc/NEWS.d/next/Library/2022-04-11-18-34-33.gh-issue-55555 .pC7gnM.rst" ,
153
+ "Misc/NEWS.d/next/Library/2022-04-11-18-34-33.gh-issue-33333 .pC7gnM.rst" ,
154
+ "root/Misc/NEWS.d/next/Library/2022-04-11-18-34-33.gh-issue-33333 .pC7gnM.rst" ,
112
155
),
113
156
(
114
- "Misc/NEWS.d/next/Core and Builtins/2023-03-17-12-09-45.gh-issue-33333 .Pf_BI7.rst" ,
115
- "root/Misc/NEWS.d/next/Core and Builtins /2023-03-17-12-09-45.gh-issue-33333 .Pf_BI7.rst" ,
157
+ "Misc/NEWS.d/next/Core and Builtins/2023-03-17-12-09-45.gh-issue-44444 .Pf_BI7.rst" ,
158
+ "root/Misc/NEWS.d/next/Core_and_Builtins /2023-03-17-12-09-45.gh-issue-44444 .Pf_BI7.rst" ,
116
159
),
117
160
(
118
- "Misc/NEWS.d/next/Tools-Demos/2023-03-21-01-27-07.gh-issue-44444 .2F1Byz.rst" ,
119
- "root/Misc/NEWS.d/next/Tools-Demos/2023-03-21-01-27-07.gh-issue-44444 .2F1Byz.rst" ,
161
+ "Misc/NEWS.d/next/Tools-Demos/2023-03-21-01-27-07.gh-issue-55555 .2F1Byz.rst" ,
162
+ "root/Misc/NEWS.d/next/Tools-Demos/2023-03-21-01-27-07.gh-issue-55555 .2F1Byz.rst" ,
120
163
),
121
164
(
122
165
"Misc/NEWS.d/next/C API/2023-03-27-22-09-07.gh-issue-66666.3SN8Bs.rst" ,
123
- "root/Misc/NEWS.d/next/C API /2023-03-27-22-09-07.gh-issue-66666.3SN8Bs.rst" ,
166
+ "root/Misc/NEWS.d/next/C_API /2023-03-27-22-09-07.gh-issue-66666.3SN8Bs.rst" ,
124
167
),
125
168
),
126
169
)
127
- def test_extract_next_filename (
128
- news_entry : str , expected_path : str , fs : FakeFilesystem
129
- ) -> None :
170
+ def test_extract_next_filename (news_entry , expected_path , fs ):
130
171
# Arrange
131
172
fs .create_file (news_entry , contents = "testing" )
132
173
blurb .root = "root"
0 commit comments