From 68dc29c6f621b86489cd1f26213489032e42b486 Mon Sep 17 00:00:00 2001 From: "gasperfele@fri1.uni-lj.si" Date: Thu, 23 Mar 2017 08:00:31 +0000 Subject: improve hints for edit_find_grep_compile_convert git-svn-id: https://svn.lusy.fri.uni-lj.si/kpov-public-svn/kpov-public@408 5cf9fbd1-b2bc-434c-b4b7-e852f4f63414 --- .../tasks/edit_find_grep_compile_convert/task.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'kpov_judge/tasks/edit_find_grep_compile_convert') diff --git a/kpov_judge/tasks/edit_find_grep_compile_convert/task.py b/kpov_judge/tasks/edit_find_grep_compile_convert/task.py index 705ddf6..8b8ecb8 100644 --- a/kpov_judge/tasks/edit_find_grep_compile_convert/task.py +++ b/kpov_judge/tasks/edit_find_grep_compile_convert/task.py @@ -266,20 +266,20 @@ def task_check(results, params): if results["dst_file_contents"] == expected_contents: score += 3 else: - #diff_pos = None - #for i, c in enumerate(results["dst_file_contents"]): - # if len(expected_contents) < i or c != expected_contents[i]: - # start = max(0, i-20) - # end = min(len(expected_contents), len(results["dst_file_contents"]), i+200) - # diff_pos = (i, expected_contents[start:end], results["dst_file_contents"][start:end]) - # break - #hints += ["wrong file contents\n" + str(diff_pos)] - hints += ["wrong file contents"] + diff_pos = "" + for i, c in enumerate(results["dst_file_contents"]): + if len(expected_contents) < i or c != expected_contents[i]: + start = max(0, i-10) + end = min(len(expected_contents), len(results["dst_file_contents"]), i+20) + diff_pos = (i, results["dst_file_contents"][start:end]) + break + hints += ["wrong file contents\n" + str(diff_pos[1])] + #hints += ["wrong file contents"] expected_ls = u"ls -l ~/{dstfile}\r\n-rw--w---- 1 {testuser} bilbo .*{dstfile}\r\n".format(**params) if re.match(expected_ls, results["dst_ls"]): score += 3 else: - hints += ["missing file or wrong user/permissions\n" + str((results["dst_ls"], expected_ls))] + hints += [u"missing file or wrong user/permissions\n" + results["dst_ls"]] if results["home_ls"].find(params['progname']) > -1: score += 2 else: @@ -298,7 +298,7 @@ def task_check(results, params): if results["tita_return"] == expected_tita: score += 2 else: - hints += ["program output incorrect\n" + str((results["tita_return"],)) + "\n" + str((expected_tita,))] + hints += [u"program output incorrect\n" + results["tita_return"]] return score, hints -- cgit v1.2.1