diff --git a/scripts/validate_questions.py b/scripts/validate_questions.py index 907b8c1..bfa804c 100644 --- a/scripts/validate_questions.py +++ b/scripts/validate_questions.py @@ -22,11 +22,12 @@ for filename in os.listdir("data/questions"): raise Exception(str(data.index(q)) + ": Question has no answers.") for a in q["answers"]: - if a["text"] == "" and a["image"] == "": - raise Exception(str(data.index(q)) + ": Answer's text and image cannot both be empty.") if type(a["text"]) is not str or type(a["image"]) is not str: raise Exception(str(data.index(q)) + ": Some answer's parameters are null, missing or their type is wrong.") + if a["text"] == "" and a["image"] == "": + raise Exception(str(data.index(q)) + ": Answer's text and image cannot both be empty.") + except Exception as e: logging.error(getattr(e, 'message', repr(e))) logging.fatal(filename + " is invalid. Aborting.")