Skip to content

DOC: clarify timing precision accessors and repair doctest example - #959

Open
quantecon-services wants to merge 1 commit into
mainfrom
claude/pensive-bohr-09y8y0
Open

quantecon-services wants to merge 1 commit into
mainfrom
claude/pensive-bohr-09y8y0

Conversation

@quantecon-services

Copy link
Copy Markdown
Collaborator

Summary

Closes out the documentation half of #889. Docstring-only change to quantecon/timings/timings.py, plus a trailing-newline fix in quantecon/timings/__init__.py.

  • Document that get_default_precision() is the read-only equivalent of float_precision() called with no argument, and explain why both exist (the timing utilities in quantecon/util/timing.py only need to read the setting).
  • Repair the float_precision() example so it passes under a strict doctest run. The print(...) line had no expected output; it is now >>> qe.timings.float_precision() with expected output 4. The >>> examples are kept rather than rewritten as prose so the module is ready for the docstring sweep in TEST: run docstring examples without comparing output (#866) #920.
  • Strip trailing whitespace in the module and add the missing newline at end of file.

No test file is added. quantecon/timings/timings.py is already at 100% line coverage via TestGlobalPrecision in quantecon/util/tests/test_timing.py, which covers get, set, the three ValueError paths, and state restoration.

Inspired by the docstring half of #914 by @lntutor, with thanks.

Validation

  • pytest --doctest-modules quantecon/timings/timings.py passes (fails on main)
  • flake8 --select=F401,F405,E231 quantecon/timings clean; full flake8 quantecon/timings also clean
  • pytest quantecon/util/tests/test_timing.py passes (27 tests)

AI disclosure

Drafted with Claude Code from a review of #914 and #915, then checked by hand.

🤖 Generated with Claude Code

https://claude.ai/code/session_016SV8c3M2nrjtkSSjQ6Ky2L


Generated by Claude Code

Document that get_default_precision() is the read-only equivalent of
float_precision() called with no argument, and note why both exist.
Repair the float_precision() example so it passes under a strict doctest
run: the print() line had no expected output. Also strip trailing
whitespace and add the missing newline at end of file.

Inspired by the docstring half of #914 by @lntutor. Closes out the
documentation criteria of #889; the module was already fully covered by
TestGlobalPrecision in quantecon/util/tests/test_timing.py.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016SV8c3M2nrjtkSSjQ6Ky2L
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 90.884%. remained the same — claude/pensive-bohr-09y8y0 into main

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.

3 participants