Exemplo n.º 1
0
 def test_modulo_prediction_fails_with_multi_mod_cands(self):
     try:
         predict_modulo(
             "<p>101で割った余りを出力してください。もしくは n modulo 103を出力してください。</p>")
         self.fail("Must not reach here")
     except MultipleModCandidatesError:
         pass
 def test_modulo_prediction_fails_with_multi_mod_cands(self):
     try:
         predict_modulo(
             "<p>101で割った余りを出力してください。もしくは n modulo 103を出力してください。</p>")
         self.fail("Must not reach here")
     except MultipleModCandidatesError:
         pass
Exemplo n.º 3
0
def do_predict_constants(result: QualityResult):
    if result.problem_content is None or result.problem_content.original_html is None:
        result.modulo_error = Skipped()
        result.yes_str_error = Skipped()
        result.no_str_error = Skipped()
        result.constant_set = ProblemConstantSet()
        return
    try:
        result.modulo = predict_modulo(result.problem_content.original_html)
    except Exception as e:
        result.modulo_error = e

    result.yes_str, result.no_str = predict_yes_no(
        result.problem_content.original_html)

    judge_method = None
    try:
        judge_method = predict_judge_method(
            result.problem_content.original_html)
        if judge_method is not None:
            result.judge_method = judge_method.to_dict()

    except Exception as e:
        result.judge_method_error = e

    result.constant_set = ProblemConstantSet(mod=result.modulo,
                                             yes_str=result.yes_str,
                                             no_str=result.no_str,
                                             judge_method=judge_method)
Exemplo n.º 4
0
    def test_tricky_mod_case_that_can_raise_multi_cands_error(self):
        # This test exists in order to demonstrate the current wrong behavior that throws MultipleModCandidatesError.
        # None is the true answer for ABC103-C. This test shouldn't fail with a better prediction method.
        # Please remove @unittest.expectedFailure when predict_modulo() behaves
        # correctly.

        modulo = predict_modulo(self._load("abc103-C.html"))
        self.assertIsNone(modulo)
    def test_tricky_mod_case_that_can_raise_multi_cands_error(self):
        # This test exists in order to demonstrate the current wrong behavior that throws MultipleModCandidatesError.
        # None is the true answer for ABC103-C. This test shouldn't fail with a better prediction method.
        # Please remove @unittest.expectedFailure when predict_modulo() behaves
        # correctly.

        modulo = predict_modulo(self._load("abc103-C.html"))
        self.assertIsNone(modulo)
Exemplo n.º 6
0
def do_predict_constants(result: QualityResult):
    if result.problem_content is None:
        result.modulo_error = Skipped()
        result.yes_str_error = Skipped()
        result.no_str_error = Skipped()
        return
    try:
        result.modulo = predict_modulo(result.problem_content.original_html)
    except Exception as e:
        result.modulo_error = e

    result.yes_str, result.no_str = predict_yes_no(
        result.problem_content.original_html)

    result.constant_set = ProblemConstantSet(mod=result.modulo,
                                             yes_str=result.yes_str,
                                             no_str=result.no_str)
def do_predict_constants(result: QualityResult):
    if result.problem_content is None or result.problem_content.original_html is None:
        result.modulo_error = Skipped()
        result.yes_str_error = Skipped()
        result.no_str_error = Skipped()
        result.constant_set = ProblemConstantSet()
        return
    try:
        result.modulo = predict_modulo(result.problem_content.original_html)
    except Exception as e:
        result.modulo_error = e

    result.yes_str, result.no_str = predict_yes_no(
        result.problem_content.original_html)

    result.constant_set = ProblemConstantSet(
        mod=result.modulo,
        yes_str=result.yes_str,
        no_str=result.no_str
    )