diff --git a/CHANGELOG.md b/CHANGELOG.md index 69549030..b8329e42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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:** diff --git a/otter/assign/utils.py b/otter/assign/utils.py index a6617ce2..c88e925d 100644 --- a/otter/assign/utils.py +++ b/otter/assign/utils.py @@ -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 (