mitodl / mitx-grading-library

The MITx Grading Library, a python grading library for edX
https://edge.edx.org/courses/course-v1:MITx+grading-library+examples/
BSD 3-Clause "New" or "Revised" License
14 stars 9 forks source link

add check for unbalanced square brackets #81

Closed ChristopherChudzicki closed 6 years ago

ChristopherChudzicki commented 6 years ago

Resolves #73.

Note that I moved all unmatched parens/brackets tests to test_calc.py and out of FormulaGrader. Previously, i understand placing that test in test_formulagrader.py in order to make sure that the correct error messages actual make it through to the student. Not, I'd rather put tests closer to their source code and test that they raise StudentFacingErrors.

jolyonb commented 6 years ago

Ok. At some point, I'm going to go through the entire apparatus and figure out just how our error handling is working...

ChristopherChudzicki commented 6 years ago

I was planning to tackle #75 next, but you can do it if you want :)

jolyonb commented 6 years ago

Nope, by all means, all yours!

ChristopherChudzicki commented 6 years ago

Ah, that's a very good point. I don't think it will actually be a very big refactoring, though :)

ChristopherChudzicki commented 6 years ago

Well, I completely overhauled the bracket balancing and the error messages. Now students see things like this:

screen shot 2018-07-13 at 1 12 37 am

Also addresses #82

jolyonb commented 6 years ago

This is really pretty. Good job!

jolyonb commented 6 years ago

Resolves #82.

ChristopherChudzicki commented 6 years ago

Fixed the typos :)

You obviously had fun writing this. It's very cute :-) Two minor typos.

It was fun :) and the deeply nested for / if's in my earlier approach were driving me nuts.

jolyonb commented 6 years ago

A FILO stack is definitely the way to do this. You made it much prettier than I would've though!