pythonwhat icon indicating copy to clipboard operation
pythonwhat copied to clipboard

Solution overriding can't use part checks

Open machow opened this issue 7 years ago • 0 comments

In the current implementation of override(), the solution is parsed into AST, but that AST is not further parsed by pythonwhat. This means that the following won't work,

Ex().check_if_else(0).override("if True: print(1)").check_body()

since check_if_else(0) parses the IfElse node, and puts it on state.student_parts, etc.. parsing.py isn't totally consistent in naming a node parsing method (sometimes it is just implemented in the visit_NODENAME method), so it's not trivial to run the new ast node through the relevant parser.

Note that putting the override before selecting the if statement will work:

Ex().override("if True: print(1)").check_if_else(0).check_body()"

machow avatar Jan 05 '17 14:01 machow