Ejemplo n.º 1
0
 def _judge_single_test(self, src_path, testcase, formatter):
     formatter.testcase_begin(testcase)
     ansfile = os.path.join(src_path, testcase.anspath)
     comp_result = compare(
         self.comp_method, testcase.infile, ansfile,
         testcase.outfile, testcase.full_score)
     result = {'score': comp_result}
     if comp_result >= testcase.full_score:
         result['verdict'] = 'Accepted'
     elif comp_result <= 0:
         result['verdict'] = 'Wrong answer'
     else:
         result['verdict'] = 'Partially accepted'
     formatter.testcase_end(testcase, result)
     return result
Ejemplo n.º 2
0
 def _judge_get_testcase_score(self, tmpdir, testcase):
     dst_out = os.path.join(tmpdir, self.outfile)
     return compare(self.comp_method, testcase.infile, dst_out,
                    testcase.outfile, testcase.full_score)
Ejemplo n.º 3
0
def test_compare_invalid():
    with pytest.raises(ValueError) as err:
        anscompare.compare('invalid-comp-type', None, None, None, 0)
    assert 'Unknown comparison type:' in str(err)