Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes unlocking to use ast.literal_eval #223

Merged
merged 1 commit into from
Sep 12, 2016
Merged

Changes unlocking to use ast.literal_eval #223

merged 1 commit into from
Sep 12, 2016

Conversation

jathak
Copy link
Contributor

@jathak jathak commented Sep 8, 2016

Resolves #211.

@@ -205,23 +203,27 @@ def testMultipleChoice_multipleFailsBeforeSuccess(self):
else:
self.validateRecord(attempt, answer=self.SHORT_ANSWER, correct=True)

EVAL_ANSWER = ['[1, 2, 3, 4]']
CORRECT_EVAL = ['[1,2,3,2+2]']
INCORRECT_EVALS = ['[4,3,2,1]', '{1,2,3,4}', '[1,2,3,8/2]']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For future reference: ast.literal_eval supports addition/subtraction of integers (but not other operations/other types)

I don't think this is worth a comment in the test.

Also might be worth a shot to give it something it just fail on - like raise Exception("test") (which throws a SyntaxError)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the 8/2 in the third incorrect eval should cause an error.

@Sumukh
Copy link
Member

Sumukh commented Sep 8, 2016

Great.

Before merge:

  • Manually test an unlocking suite from the lab/project
  • Runs test with something that produces a syntax error (like raise Exception or a = 1)

@jathak
Copy link
Contributor Author

jathak commented Sep 12, 2016

Tested with lab02 and it seems to work as expected.

@Sumukh
Copy link
Member

Sumukh commented Sep 12, 2016

Thanks for testing it. Merging now.

@Sumukh Sumukh merged commit 705c868 into master Sep 12, 2016
@Sumukh Sumukh deleted the literal-eval branch September 12, 2016 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants