aboutsummaryrefslogtreecommitdiffstats
path: root/backend/models
diff options
context:
space:
mode:
authorGravatar Hassan Abouelela <[email protected]>2021-06-02 13:35:21 +0300
committerGravatar Hassan Abouelela <[email protected]>2021-06-02 13:35:47 +0300
commitee15ceccc8b2b690d0c383ac596ca95c36180a9a (patch)
tree8450b1aa8c596fa82e0a461f542e188df3887f05 /backend/models
parentDocuments Return Code (diff)
Adds Missing Docstrings
Signed-off-by: Hassan Abouelela <[email protected]>
Diffstat (limited to 'backend/models')
-rw-r--r--backend/models/question.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/backend/models/question.py b/backend/models/question.py
index 9829843..8972bc1 100644
--- a/backend/models/question.py
+++ b/backend/models/question.py
@@ -8,11 +8,13 @@ _TESTS_TYPE = t.Union[t.Dict[str, str], int]
class Unittests(BaseModel):
+ """Schema model for unittest suites in code questions."""
allow_failure: bool = False
tests: _TESTS_TYPE
@validator("tests")
def validate_tests(cls, value: _TESTS_TYPE) -> _TESTS_TYPE:
+ """Confirm that at least one test exists in a test suite."""
if isinstance(value, dict) and not len(value.keys()):
raise ValueError("Must have at least one test in a test suite.")
@@ -20,6 +22,7 @@ class Unittests(BaseModel):
class CodeQuestion(BaseModel):
+ """Schema model for questions of type `code`."""
language: str
unittests: t.Optional[Unittests]