Skip to content

Commit 6d1890a

Browse files
Remove the walrus operator for Python 3.6 compatibility (#450)
Remove the walrus operator for Python 3.6 compatibility Related to #444. We still support EL8 and thus Python 3.6. CI didn't catch this because it didn't even run on RHEL8 (dcermak can't run tests (and builds) internally - is there a way for a repo owner to overcome this?). Reviewed-by: Laura Barcziová Reviewed-by: Matej Focko Reviewed-by: Maja Massarini
2 parents 84d6f3b + 29574b3 commit 6d1890a

File tree

1 file changed

+52
-42
lines changed

1 file changed

+52
-42
lines changed

tests/unit/test_changelog.py

Lines changed: 52 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -257,47 +257,35 @@ def test_suse_style_changelog_parse():
257257
"changelog",
258258
data=[
259259
"-------------------------------------------------------------------",
260-
(
261-
hdr1 := "Tue Dec 17 14:21:37 UTC 2024 - "
262-
+ (dc := "Dan Čermák <[email protected]>")
263-
),
260+
"Tue Dec 17 14:21:37 UTC 2024 - Dan Čermák <[email protected]>",
264261
"",
265-
(content1 := "- First version"),
262+
"- First version",
266263
"",
267264
"-------------------------------------------------------------------",
268-
(hdr2 := f"Mon Nov 4 17:47:23 UTC 2024 - {dc}"),
265+
"Mon Nov 4 17:47:23 UTC 2024 - Dan Čermák <[email protected]>",
269266
"",
270-
(content2 := "- # [0.9.37] - September 4th, 2024"),
267+
"- # [0.9.37] - September 4th, 2024",
271268
"",
272269
"-------------------------------------------------------------------",
273-
(
274-
hdr3 := "Fri May 17 09:14:20 UTC 2024 - "
275-
+ "Dominique Leuenberger <[email protected]>"
276-
),
270+
"Fri May 17 09:14:20 UTC 2024 - Dominique Leuenberger <[email protected]>",
277271
"",
278-
(content3 := "- Use %patch -P N instead of deprecated %patchN syntax."),
272+
"- Use %patch -P N instead of deprecated %patchN syntax.",
279273
"",
280274
"-------------------------------------------------------------------",
281-
(
282-
hdr4 := "Mon Oct 10 13:27:24 UTC 2022 - Stephan Kulow <[email protected]>"
283-
),
275+
"Mon Oct 10 13:27:24 UTC 2022 - Stephan Kulow <[email protected]>",
284276
"",
285-
(content4_1 := "updated to version 0.9.28"),
286-
(content4_2 := " see installed CHANGELOG.md"),
277+
"updated to version 0.9.28",
278+
" see installed CHANGELOG.md",
287279
"",
288280
"",
289281
"-------------------------------------------------------------------",
290-
(
291-
hdr5 := "Fri Jun 25 07:31:34 UTC 2021 - Dan Čermák <[email protected]>"
292-
),
282+
"Fri Jun 25 07:31:34 UTC 2021 - Dan Čermák <[email protected]>",
293283
"",
294-
(content5_1 := "- New upstream release 0.9.26"),
284+
"- New upstream release 0.9.26",
295285
"",
296-
(content5_2 := " - Add support for Ruby 3.0 and fix tests"),
297-
(
298-
content5_3 := " - Fix support for `frozen_string_literal: false`"
299-
+ " magic comments (#1363)"
300-
),
286+
" - Add support for Ruby 3.0 and fix tests",
287+
" - Fix support for `frozen_string_literal: false`"
288+
" magic comments (#1363)",
301289
"",
302290
"",
303291
],
@@ -309,14 +297,28 @@ def test_suse_style_changelog_parse():
309297

310298
for changelog_entry, hdr, content in zip(
311299
changelog,
312-
reversed((hdr1, hdr2, hdr3, hdr4, hdr5)),
313300
reversed(
314301
(
315-
[content1],
316-
[content2],
317-
[content3],
318-
[content4_1, content4_2],
319-
[content5_1, "", content5_2, content5_3],
302+
"Tue Dec 17 14:21:37 UTC 2024 - Dan Čermák <[email protected]>",
303+
"Mon Nov 4 17:47:23 UTC 2024 - Dan Čermák <[email protected]>",
304+
"Fri May 17 09:14:20 UTC 2024 - Dominique Leuenberger <[email protected]>",
305+
"Mon Oct 10 13:27:24 UTC 2022 - Stephan Kulow <[email protected]>",
306+
"Fri Jun 25 07:31:34 UTC 2021 - Dan Čermák <[email protected]>",
307+
)
308+
),
309+
reversed(
310+
(
311+
["- First version"],
312+
["- # [0.9.37] - September 4th, 2024"],
313+
["- Use %patch -P N instead of deprecated %patchN syntax."],
314+
["updated to version 0.9.28", " see installed CHANGELOG.md"],
315+
[
316+
"- New upstream release 0.9.26",
317+
"",
318+
" - Add support for Ruby 3.0 and fix tests",
319+
" - Fix support for `frozen_string_literal: false`"
320+
" magic comments (#1363)",
321+
],
320322
)
321323
),
322324
):
@@ -336,27 +338,35 @@ def test_suse_style_changelog_parse():
336338
(
337339
datetime.datetime(2021, 6, 25, 7, 31, 34),
338340
"Dan Čermák <[email protected]>",
339-
content_1 := ["", "New upstream release 0.9.26"],
341+
["", "New upstream release 0.9.26"],
340342
ChangelogEntry(
341-
header=_OPENSUSE_CHANGELOG_SEPARATOR
342-
+ "\n"
343-
+ "Fri Jun 25 07:31:34 UTC 2021 - Dan Čermák <[email protected]>",
344-
content=content_1,
343+
header=(
344+
_OPENSUSE_CHANGELOG_SEPARATOR
345+
+ "\n"
346+
+ "Fri Jun 25 07:31:34 UTC 2021 - Dan Čermák <[email protected]>"
347+
),
348+
content=["", "New upstream release 0.9.26"],
345349
),
346350
),
347351
(
348352
datetime.date(2021, 6, 25),
349353
"Dan Čermák <[email protected]>",
350-
content_2 := [
354+
[
351355
"",
352356
"New upstream release 0.26",
353357
"Fixed a major regression in Foo",
354358
],
355359
ChangelogEntry(
356-
header=_OPENSUSE_CHANGELOG_SEPARATOR
357-
+ "\n"
358-
+ "Fri Jun 25 12:00:00 UTC 2021 - Dan Čermák <[email protected]>",
359-
content=content_2,
360+
header=(
361+
_OPENSUSE_CHANGELOG_SEPARATOR
362+
+ "\n"
363+
+ "Fri Jun 25 12:00:00 UTC 2021 - Dan Čermák <[email protected]>"
364+
),
365+
content=[
366+
"",
367+
"New upstream release 0.26",
368+
"Fixed a major regression in Foo",
369+
],
360370
),
361371
),
362372
]

0 commit comments

Comments
 (0)