Skip to content

Commit

Permalink
Fix converting indented functions in test cells to doctests (#869)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrispyles authored Oct 25, 2024
1 parent 4b02102 commit 14ede16
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
* Added Otter Assign support for the `all_or_nothing` config per [#751](https://github.com/ucbds-infra/otter-grader/issues/751)
* Updated Otter Assign to only allow a function definition and statement to call the test function in exception-based test cells and automatically ignore the latter statement instead of requiring an explicit `# IGNORE` comment per [#516](https://github.com/ucbds-infra/otter-grader/issues/516)
* Added additional package versions to the output of `otter --version` per [#843](https://github.com/ucbds-infra/otter-grader/issues/843)
* Fixed bug in converting test cells containing indented functions to doctests in Otter Assign per [#840](https://github.com/ucbds-infra/otter-grader/issues/840)

**v5.7.1:**

Expand Down
3 changes: 3 additions & 0 deletions otter/assign/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ def str_to_doctest(code_lines: list[str], lines: list[str]) -> list[str]:
if len(code_lines) == 0:
return lines
line = code_lines.pop(0)
# skip empty lines
while not line:
line = code_lines.pop(0)
if line.startswith(" ") or line.startswith("\t"):
return str_to_doctest(code_lines, lines + ["... " + line])
elif (
Expand Down

0 comments on commit 14ede16

Please sign in to comment.