Fix bare ... doctest terminators in replay scripts#8
Merged
Conversation
strip_doctest_prompts() now drops bare '...' lines and '...' prompts followed only by whitespace, which are doctest block terminators with no Python semantics. Continuation prompts with code and explicit '>>> ...' ellipsis usage are unchanged. Adds unit and integration tests, and extends the Replay session docs example with a multi-line class definition. Fixes #7 Co-authored-by: chrizzftd <chrizzFTD@users.noreply.github.com>
Documentation build overview
|
A bare '...' marks the end of a multi-line REPL input block. Dropping it entirely caused the next statement to be parsed as a continuation, e.g. 'Foo()' after a class definition. Emit a blank line instead of Ellipsis or nothing. Co-authored-by: chrizzftd <chrizzFTD@users.noreply.github.com>
Bump version, add CHANGELOG, and add PyPI publish workflow triggered by GitHub releases. Co-authored-by: chrizzftd <chrizzFTD@users.noreply.github.com>
Co-authored-by: chrizzftd <chrizzFTD@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #7 — bare
...doctest block terminators were preserved as PythonEllipsisin generated replay scripts, causingSyntaxErrorduring interactive replay.Changes
strip_doctest_prompts()now drops:...lines (doctest block terminators)...prompts followed only by whitespace (e.g....)... x = 1) and explicit>>> ...ellipsis usage are unchanged.strip_doctest_prompts()plus a full-build integration test.docs/example.rstwith a multi-line class definition using standard doctest formatting.Verification
python3 -m pytest .— 11 passedsphinx-build docs docs/_build— succeeded; generated replay script omits bare...