Skip to content

docs: make README examples self-contained (fix #116) - #272

Open
CAOShurong wants to merge 1 commit into
jaraco:mainfrom
CAOShurong:fix/readme-examples-self-contained
Open

CAOShurong wants to merge 1 commit into
jaraco:mainfrom
CAOShurong:fix/readme-examples-self-contained

Conversation

@CAOShurong

Copy link
Copy Markdown

Summary

The README's SYNOPSIS example blocks reference N1, cat_count, thing, and idea without ever defining them, so copying the examples verbatim raises NameError. 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 from README.rst (78 blocks) and executed them in a single namespace. Before the fix:

line 317: NameError("name 'N1' is not defined")
line 331: NameError("name 'cat_count' is not defined")
line 337: NameError("name 'thing' is not defined")

After the fix: 78/78 blocks execute with zero errors, all producing the documented output. Full test suite unaffected:

214 passed, 16 xfailed

Note: the other concerns raised in #116 (the p.gender('f') call and the reported whitespace issues) were already addressed on main — the README now correctly uses p.gender("feminine"), and plural_verb/no output formatting matches the documented strings when run. The only remaining runtime breakage was the undefined variables fixed here.

Notes

  • Docs-only change; no library code touched.
  • AI assistance was used to scaffold and verify the reproduction harness; the fix itself is a minimal documentation edit.

🤖 Generated with Hermes

…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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multiple issues with code on pypi page

1 participant