-
Notifications
You must be signed in to change notification settings - Fork 25
Build test URLs with f-strings instead of string concatenation #644
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or requestpriority:lowNice-to-have improvement. Can be deferred without blocking other work.Nice-to-have improvement. Can be deferred without blocking other work.pythonPull requests that update Python codePull requests that update Python codepython:idiomsRefactors toward idiomatic Python (PEP conventions, stdlib idioms)Refactors toward idiomatic Python (PEP conventions, stdlib idioms)
Description
Activity
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestpriority:lowNice-to-have improvement. Can be deferred without blocking other work.Nice-to-have improvement. Can be deferred without blocking other work.pythonPull requests that update Python codePull requests that update Python codepython:idiomsRefactors toward idiomatic Python (PEP conventions, stdlib idioms)Refactors toward idiomatic Python (PEP conventions, stdlib idioms)
Problem
tests/test_main.pybuilds request paths by concatenating fragments:The file already uses f-strings elsewhere
(
f"/players/squadnumber/{player.squad_number}"), so the style isinconsistent. The
+ "/" + str(...)form is noisy and fragile — the firstexample only produces a valid URL because
PATHhappens to end in/.Proposed Solution
Use f-strings consistently, and lift the repeated literal into a constant next
to the existing
PATH:Suggested Approach
SQUAD_PATHbesidePATH.PATH + ... + str(...)with an f-string.uv run pytest.tests/test_main.pyis excluded from Black — keep the manual formattingstyle.
Acceptance Criteria
+-based URL building remains intests/test_main.pyCHANGELOG.mdupdatedReferences