From 9991a8e8031ab6c1d33577bc759a6c7b03183ea3 Mon Sep 17 00:00:00 2001 From: Hassan Abouelela Date: Thu, 3 Jun 2021 03:02:01 +0300 Subject: Clarify Validator Semantics Co-authored-by: Chris Signed-off-by: Hassan Abouelela --- backend/models/question.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'backend/models') diff --git a/backend/models/question.py b/backend/models/question.py index 8972bc1..5a1334a 100644 --- a/backend/models/question.py +++ b/backend/models/question.py @@ -15,7 +15,7 @@ class Unittests(BaseModel): @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()): + if isinstance(value, dict) and len(value.keys()) == 0: raise ValueError("Must have at least one test in a test suite.") return value -- cgit v1.2.3