otter-grader
otter-grader copied to clipboard
Auto-ignore lines calling the exception test function in Otter Assign
For exception tests in Otter Assign, test cells are formatted like
def test(var):
# some logic
test(var) # IGNORE
Needing to remember the # IGNORE
comment is cumbersome. Since each cell should have only 1 test in it, we can parse the cell and remove all lines outside the function body.
This can probably be done by parsing the cell's source as an AST, removing all nodes except the first def
node, and using astunparse
to convert this back to Python code.