diff options
Diffstat (limited to 'backend')
-rw-r--r-- | backend/routes/forms/unittesting.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/backend/routes/forms/unittesting.py b/backend/routes/forms/unittesting.py index ef86e7f..4b362e1 100644 --- a/backend/routes/forms/unittesting.py +++ b/backend/routes/forms/unittesting.py @@ -1,4 +1,3 @@ -import ast from collections import namedtuple from itertools import count from textwrap import indent @@ -15,6 +14,9 @@ with open("resources/unittest_template.py") as file: UnittestResult = namedtuple("UnittestResult", "question_id return_code passed result") +# Mapping of questions to their generated +_unit_cache: dict[str, str] = {} + def filter_unittests(form: Form) -> Form: """ @@ -35,7 +37,7 @@ def _make_unit_code(units: dict[str, str]) -> str: for unit_name, unit_code in units.items(): result += ( - f"\ndef test_{unit_name.lstrip('#')}(unit):" # Function definition + f"\ndef test_{unit_name.lstrip('#')}(unit):" # Function definition f"\n{indent(unit_code, ' ')}" # Unit code ) |