def check_current_test(self, data):
        if self.inspector:
            inspector_result, inspector_result_addon = self.inspector(self.code, self.runner)
            self.inspector = None
            self.current_test["inspector_result_addon"] = inspector_result_addon
            if not inspector_result:
                self.current_test["inspector_fail"] = True
                api.request_write_ext(self.current_test)
                return api.fail(0, inspector_result_addon)
        user_result = data['result']

        check_result = self.check_user_answer(user_result)
        self.current_test["result"], self.current_test["result_addon"] = check_result

        api.request_write_ext(self.current_test)

        if not self.current_test["result"]:
            return api.fail(self.current_step, self.get_current_test_fullname())

        if self.next_step():
            self.test_current_step()
        else:
            if self.next_env():
                self.restart_env()
            else:
                code_len = count_code_length(self.code)
                api.success(max(self.max_length - code_len, 0))
Exemple #2
0
    def check_current_test(self, data):
        if self.inspector:
            inspector_result, inspector_result_addon = self.inspector(
                self.code, self.runner)
            self.inspector = None
            self.current_test[
                "inspector_result_addon"] = inspector_result_addon
            if not inspector_result:
                self.current_test["inspector_fail"] = True
                api.request_write_ext(self.current_test)
                return api.fail(0, inspector_result_addon)
        user_result = data.get('result')

        check_result = self.check_user_answer(user_result)
        self.current_test["result"], self.current_test[
            "result_addon"] = check_result

        api.request_write_ext(self.current_test)

        if not self.current_test["result"]:
            return api.fail(self.current_step,
                            self.get_current_test_fullname())

        if self.next_step():
            self.test_current_step()
        else:
            if self.next_env():
                self.restart_env()
            else:
                api.success()
    def check_current_test(self, data):
        user_result = data['result']

        self.referee_data = self.process_referee(self.referee_data, user_result)

        self.total_score += self.referee_data.get("score", 0)

        referee_result = self.referee_data.get("result", False)

        if referee_result and self.is_win_referee:
            is_win_result = self.is_win_referee(self.referee_data)
        else:
            is_win_result = referee_result.get("is_win", False)

        self.referee_data.update({"is_win": is_win_result})

        api.request_write_ext(self.referee_data)

        if not referee_result:
            return api.fail(self.current_step, self.get_current_test_fullname())

        if not is_win_result:
            self.test_current_step()
        else:
            if self.next_env():
                self.restart_env()
            else:
                api.success(score=self.total_score)
    def check_current_test(self, data):
        if self.inspector:
            inspector_result, inspector_result_addon = self.inspector(self.code, self.runner)
            self.inspector = None
            self.current_test["inspector_result_addon"] = inspector_result_addon
            if not inspector_result:
                self.current_test["inspector_fail"] = True
                api.request_write_ext(self.current_test)
                return api.fail(0, inspector_result_addon)
        user_result = data["result"]

        check_result = self.check_user_answer(user_result)
        self.current_test["result"], self.current_test["result_addon"] = check_result

        api.request_write_ext(self.current_test)

        if not self.current_test["result"]:
            return api.fail(self.current_step, self.get_current_test_fullname())

        if self.next_step():
            self.test_current_step()
        else:
            if self.next_env():
                self.restart_env()
            else:
                code_len = len(self.code)
                if code_len >= self.max_length:
                    message = "Your code is correct, but this is too long ({}) for any points".format(code_len)
                    self.current_test["inspector_result_addon"] = message
                    self.current_test["inspector_fail"] = True
                    api.request_write_ext(self.current_test)
                    return api.fail(0, message)
                else:
                    api.success(self.max_length - code_len)
    def check_current_test(self, data):
        user_result = data["result"]

        self.referee_data = self.process_referee(self.referee_data, user_result)

        referee_result = self.referee_data.get("result", False)

        is_win_result = False

        if referee_result:
            is_win_result = self.is_win_referee(self.referee_data)

        self.referee_data.update({"is_win": is_win_result})

        api.request_write_ext(self.referee_data)

        if not referee_result:
            return api.fail(self.current_step, self.get_current_test_fullname())

        if not is_win_result:
            self.test_current_step()
        else:
            if self.next_env():
                self.restart_env()
            else:
                api.success()
Exemple #6
0
    def check_current_test(self, data):
        user_result = data['result']

        self.referee_data = self.process_referee(self.referee_data,
                                                 user_result)

        referee_result = self.referee_data.get("result", False)

        is_win_result = False

        if referee_result:
            is_win_result = self.is_win_referee(self.referee_data)

        self.referee_data.update({"is_win": is_win_result})

        api.request_write_ext(self.referee_data)

        if not referee_result:
            return api.fail(self.current_step,
                            self.get_current_test_fullname())

        if not is_win_result:
            self.test_current_step()
        else:
            if self.next_env():
                self.restart_env()
            else:
                api.success()
Exemple #7
0
    def check_current_test(self, data):

        if self.inspector:
            inspector_result, inspector_result_addon = self.inspector(self.code, self.runner)
            self.inspector = None
            self.current_test["inspector_result_addon"] = inspector_result_addon
            if not inspector_result:
                self.current_test["inspector_fail"] = True
                api.request_write_ext(self.current_test)
                return api.fail(0, inspector_result_addon)


        test_result = data["result"]
        self.current_test.update(test_result)
        check_result = self.check_user_answer(test_result)

        self.current_test["result"], self.current_test["result_addon"] = check_result

        api.request_write_ext(self.current_test)

        if not self.current_test["result"]:
            return api.fail(self.current_step, self.get_current_test_fullname())

        if self.next_step():
            self.test_current_step()
        else:
            if self.next_env():
                self.restart_env()
            else:
                api.success()
    def check_current_test(self, data):
        if self.inspector:
            inspector_result, inspector_result_addon = self.inspector(self.code, self.runner)
            self.inspector = None
            self.current_test["inspector_result_addon"] = inspector_result_addon
            if not inspector_result:
                self.current_test["inspector_fail"] = True
                api.request_write_ext(self.current_test)
                return api.fail(0, inspector_result_addon)
        user_result = data['result']

        check_result = self.check_user_answer(user_result)
        self.current_test["result"], self.current_test["result_addon"] = check_result

        api.request_write_ext(self.current_test)

        if not self.current_test["result"]:
            return api.fail(self.current_step, self.get_current_test_fullname())

        if self.next_step():
            self.test_current_step()
        else:
            if self.next_env():
                self.restart_env()
            else:
                score, pep8_results = count_pep8(self.code)
                api.request_write_in("FINAL", "req")
                api.request_write_ext({"result": True, "check_data": pep8_results})
                api.success(score)
 def check_current_test(self, data):
     user_result = data['result']
     check_result = self.check_user_answer(user_result)
     self.current_test["result"], self.current_test["result_addon"] = check_result
     api.request_write_ext(self.current_test)
     if not self.current_test["result"]:
         return api.fail(self.current_step, self.get_current_test_fullname())
     if self.next_step():
         self.test_current_step()
     else:
         if self.next_env():
             self.restart_env()
         else:
             # all tests passed. now check code size.
             code_len = self.check_code(self.code)
             if isinstance(code_len, str):
                 message = 'Something wrong: ' + code_len
                 self.current_test["inspector_result_addon"] = message
                 self.current_test["inspector_fail"] = True
                 api.request_write_ext(self.current_test)
                 return api.fail(0, message)
             if code_len >= self.max_length:
                 message = "Your code is correct, but this compiled code is too long ({}) for any points".format(
                     code_len)
                 self.current_test["inspector_result_addon"] = message
                 self.current_test["inspector_fail"] = True
                 api.request_write_ext(self.current_test)
                 return api.fail(0, message)
             else:
                 api.success(self.max_length - code_len)
    def check_current_test(self, data):

        test_result = data["result"]["code_result"]
        best_gifts, bag_count, gift_count = test_result
        self.current_test["result_addon"] = test_result

        self.current_test["result"] = bool(best_gifts)
        self.current_test["result_message"] = "You won {:n} best gifts from {:n} bags with {:,} gifts!".format(
            best_gifts, bag_count, gift_count)

        api.request_write_ext(self.current_test)

        if not self.current_test["result"]:
            return api.fail(self.current_step, self.get_current_test_fullname())
        api.success(best_gifts)
    def check_current_test(self, data):
        user_result = data['result']

        check_result = self.check_user_answer(user_result)
        self.current_test["result"], self.current_test["result_addon"] = check_result

        api.request_write_ext(self.current_test)

        if not self.current_test["result"]:
            return api.fail(self.current_step, self.get_current_test_fullname())

        if self.next_step():
            self.test_current_step()
        else:
            if self.next_env():
                self.restart_env()
            else:
                api.success()
Exemple #12
0
    def check_current_test(self, data):
        user_result = data['result']

        check_result = self.check_user_answer(user_result)
        self.current_test["result"], self.current_test[
            "result_addon"] = check_result

        api.request_write_ext(self.current_test)

        if not self.current_test["result"]:
            return api.fail(self.current_step,
                            self.get_current_test_fullname())

        if self.next_step():
            self.test_current_step()
        else:
            if self.next_env():
                self.restart_env()
            else:
                api.success()
Exemple #13
0
    def check_current_test(self, data):

        self.referee_data["recent_results"].append(data["result"])
        self.referee_data = self.process_referee(self.referee_data)

        referee_result = self.referee_data.get("result", False)

        is_win_result = self.referee_data.get("is_win", False)

        api.request_write_ext(self.referee_data)

        if not referee_result:
            return api.fail(self.current_step, self.get_current_test_fullname())

        if not is_win_result:
            self.test_current_step()
        else:
            if self.next_env():
                self.restart_env()
            else:
                api.success()
    def check_current_test(self, data):
        self.current_test["code"] = self.code

        if data['result'] == self.code:
            self.current_test["result"] = True
            api.request_write_ext(self.current_test)
            return api.success(0)
        else:
            message = 'quine() returned different string.'
            self.current_test["result"] = False
            self.current_test["result_addon"] = message
            api.request_write_ext(self.current_test)
            return api.fail(0, message)
    def check_current_test(self, data):
        self.current_test["code"] = self.code

        if data['result'] == self.code:
            self.current_test["result"] = True
            api.request_write_ext(self.current_test)
            return api.success(0)
        else:
            message = 'quine() returned different string.'
            self.current_test["result"] = False
            self.current_test["result_addon"] = message
            api.request_write_ext(self.current_test)
            return api.fail(0, message)
Exemple #16
0
    def check_current_test(self, data):
        if self.inspector:
            inspector_result, inspector_result_addon = self.inspector(
                self.code, self.runner)
            self.inspector = None
            self.current_test[
                "inspector_result_addon"] = inspector_result_addon
            if not inspector_result:
                self.current_test["inspector_fail"] = True
                api.request_write_ext(self.current_test)
                return api.fail(0, inspector_result_addon)
        user_result = data['result']

        check_result = self.check_user_answer(user_result)
        self.current_test["result"], self.current_test[
            "result_addon"] = check_result

        api.request_write_ext(self.current_test)

        if not self.current_test["result"]:
            return api.fail(self.current_step,
                            self.get_current_test_fullname())

        if self.next_step():
            self.test_current_step()
        else:
            if self.next_env():
                self.restart_env()
            else:
                code_len = len(self.code)
                if code_len >= self.max_length:
                    message = "Your code is correct, but this is too long ({}) for any points".format(
                        code_len)
                    self.current_test["inspector_result_addon"] = message
                    self.current_test["inspector_fail"] = True
                    api.request_write_ext(self.current_test)
                    return api.fail(0, message)
                else:
                    api.success(self.max_length - code_len)