Exemple #1
0
    def test(self, test_run: TestRun) -> Optional[CheckResult]:
        self._check_errors()

        test_case = test_run.test_case

        try:
            result = test_case.dynamic_testing()
            self._check_errors()
            return result
        except BaseException as ex:
            test_run.set_error_in_test(ex)

        error = test_run.error_in_test

        if isinstance(error, TestPassed):
            return CheckResult.correct()
        elif isinstance(error, WrongAnswer):
            return CheckResult.wrong(error.feedback)
        else:
            return None
 def _custom_check(self, reply: str, expected: str):
     is_correct = reply.strip() == expected.strip()
     return CheckResult(is_correct, '')