# HG changeset patch # User nishanth # Date 1271918841 -19800 # Node ID 0842b3439c3e1518d0e240e496ac71d435b8b5f4 # Parent 3643f59f141e0fff0dd9875a630f0862993176dc implemented extra filter on string patterns. now string patterns will not be split like other pattersns diff -r 3643f59f141e -r 0842b3439c3e question_bank.xml --- a/question_bank.xml Thu Apr 22 06:23:53 2010 +0530 +++ b/question_bank.xml Thu Apr 22 12:17:21 2010 +0530 @@ -391,13 +391,19 @@ -What is the largest integer value that can be represented natively by Python? +What is the largest integer value that can be represented by Python? 30 + +No Limit +2**32 +2**32 - 1 +None of the above + -correct manually +No Limit @@ -464,8 +470,14 @@ 30 + +40 +tttttttttttttttttttttttttttttttttttttttt +t40 +Error + -correct manually +tttttttttttttttttttttttttttttttttttttttt @@ -480,7 +492,8 @@ 30 -correct manually +"a, b, c" +'a, b, c' @@ -576,12 +589,14 @@ error +Error +ERROR -What is the value of func(1) where +What is the value of func(1), if def func(x, y=10): @@ -591,18 +606,23 @@ 60 -2 10 -2 , 10 +2 20 -How many items can a function return +How many items can a function return ? 30 + +One +Multiple +Two +None + Multiple diff -r 3643f59f141e -r 0842b3439c3e quiz/management/commands/seed_que.py --- a/quiz/management/commands/seed_que.py Thu Apr 22 06:23:53 2010 +0530 +++ b/quiz/management/commands/seed_que.py Thu Apr 22 12:17:21 2010 +0530 @@ -20,7 +20,6 @@ description_node = question.getElementsByTagName("description")[0] description = (description_node.childNodes[0].data).strip() - print description time_limit_node = question.getElementsByTagName("time_limit")[0] time_limit = time_limit_node.childNodes[0].data diff -r 3643f59f141e -r 0842b3439c3e quiz/utils.py --- a/quiz/utils.py Thu Apr 22 06:23:53 2010 +0530 +++ b/quiz/utils.py Thu Apr 22 12:17:21 2010 +0530 @@ -14,7 +14,10 @@ expected_ans = answer.question.expected_ans - ans_regex_patterns = [ r"\s*".join(ans_pattern.split()) for ans_pattern in expected_ans.split("\n") ] + ans_regex_patterns = [] + for ans_pattern in expected_ans.split("\n"): + ans_regex_patterns.append( r"\s*".join(ans_pattern.split()) if not re.match(r"""^[",']""", ans_pattern) else ans_pattern ) + for pattern in ans_regex_patterns: if re.findall(pattern, answer.submitted_ans): answer.is_correct = True