diff options
Diffstat (limited to 'backend/routes/forms/unittesting.py')
-rw-r--r-- | backend/routes/forms/unittesting.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/backend/routes/forms/unittesting.py b/backend/routes/forms/unittesting.py index c093718..13fa639 100644 --- a/backend/routes/forms/unittesting.py +++ b/backend/routes/forms/unittesting.py @@ -36,12 +36,14 @@ def _make_unit_code(units: dict[str, str]) -> str: result = "" for unit_name, unit_code in units.items(): - test_prefix = "test_" if unit_name != "setUp" else "" - - result += ( - f"\ndef {test_prefix}{unit_name.removeprefix('#')}(self):" # Function definition - f"\n{indent(unit_code, ' ')}" # Unit code - ) + # Function definition + if unit_name == "setUp": + result += "\ndef setUp(self):" + else: + result += f"\nasync def {unit_name.removeprefix('#')}(self):" + + # Unite code + result += f"\n{indent(unit_code, ' ')}" return indent(result, " ") |