docs: make README examples self-contained (fix #116) - #272
Open
CAOShurong wants to merge 1 commit into
Open
CAOShurong wants to merge 1 commit into
CAOShurong wants to merge 1 commit into
Conversation
…g, idea) The SYNOPSIS/example blocks reference N1, cat_count, thing, and idea without defining them, so copying the README examples verbatim raises NameError. Define each variable immediately before use so the examples run as written (resolves jaraco#116). Verified: all 78 README code blocks execute with zero errors against inflect.engine(); full test suite unaffected (214 passed, 16 xfailed).
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
The README's SYNOPSIS example blocks reference
N1,cat_count,thing, andideawithout ever defining them, so copying the examples verbatim raisesNameError. This resolves #116 ("Multiple issues with code on pypi page").This PR makes those four examples self-contained by defining each variable immediately before use, so the documented output is reproduced as written.
Verification (no run no claim)
I extracted every
>>>code block fromREADME.rst(78 blocks) and executed them in a single namespace. Before the fix:After the fix: 78/78 blocks execute with zero errors, all producing the documented output. Full test suite unaffected:
Note: the other concerns raised in #116 (the
p.gender('f')call and the reported whitespace issues) were already addressed onmain— the README now correctly usesp.gender("feminine"), andplural_verb/nooutput formatting matches the documented strings when run. The only remaining runtime breakage was the undefined variables fixed here.Notes
🤖 Generated with Hermes