aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Matteo Bertucci <[email protected]>2021-02-25 14:45:35 +0100
committerGravatar Matteo Bertucci <[email protected]>2021-02-25 14:45:35 +0100
commitbfc44e81cb0ea6b9997d8ca701b3f525ddcd50df (patch)
treef719e6ca2f4081f8048abd928dcff7fec5e03f54
parentRemove unneeded temp variable (diff)
Make _make_unit_code more readable
-rw-r--r--backend/routes/forms/unittesting.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/backend/routes/forms/unittesting.py b/backend/routes/forms/unittesting.py
index c11e4ad..ef86e7f 100644
--- a/backend/routes/forms/unittesting.py
+++ b/backend/routes/forms/unittesting.py
@@ -34,7 +34,10 @@ def _make_unit_code(units: dict[str, str]) -> str:
result = ""
for unit_name, unit_code in units.items():
- result += f"\ndef test_{unit_name.lstrip('#')}(unit):\n{indent(unit_code, ' ')}"
+ result += (
+ f"\ndef test_{unit_name.lstrip('#')}(unit):" # Function definition
+ f"\n{indent(unit_code, ' ')}" # Unit code
+ )
return indent(result, " ")