You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MAINT: Add tests for quantecon/timings and deduplicate its accessors #889
quantecon/timings/ is the only subpackage with no test file at all, yet it exposes public API — qe.timings.float_precision() is reachable from the top-level namespace. It is 66 lines with two public functions and a module-level mutable global. Three things to address:
No tests.float_precision() has a validation branch (ValueError for non-integer or negative input) and get/set dual behaviour, neither exercised. The module-level global means tests need to restore state — worth getting right in the first test rather than retrofitting.
Two names for one read.float_precision() called with no argument and get_default_precision() return the same value by the same mechanism. One can go, or the relationship should be documented — as it stands a reader cannot tell which is canonical.
I’m taking this. I’ll add isolated coverage for the get/set/error paths with state restoration, document the accessor relationship without breaking compatibility, and revise the uncollected doctest-style examples.
Closing this with a correction, since the premise turned out to be only partly right.
Criterion 1 (no tests) was already satisfied when the issue was opened.quantecon/timings/ has no test directory, but the module is fully exercised by TestGlobalPrecision in quantecon/util/tests/test_timing.py: get, set, all three ValueError paths (negative int, float, string), and state restoration via setup_method/teardown_method. Running that file alone gives 100% line coverage of quantecon/timings/timings.py on main. The audit checked for a test file per directory rather than by coverage, which is how this slipped through.
Criterion 2 (accessor relationship undocumented) was real but small. Removing get_default_precision() is not an option since quantecon/util/timing.py calls it in three places as the read-only accessor. #959 documents the relationship in its docstring.
Criterion 3 (doctest examples never run) is being handled more broadly. The only thing that fails under strict doctest is the print(...) line with no expected output; #959 repairs that single line and keeps the >>> examples so the module is ready for the package-wide docstring sweep in #920.
Two PRs were opened against this issue and both authors put in careful work:
Activity
lntutor commentedon Jul 26, 2026
I’m taking this. I’ll add isolated coverage for the get/set/error paths with state restoration, document the accessor relationship without breaking compatibility, and revise the uncollected doctest-style examples.
quantecon-services commentedon Sep 9, 2026
Closing this with a correction, since the premise turned out to be only partly right.
Criterion 1 (no tests) was already satisfied when the issue was opened.
quantecon/timings/has no test directory, but the module is fully exercised byTestGlobalPrecisioninquantecon/util/tests/test_timing.py: get, set, all threeValueErrorpaths (negative int, float, string), and state restoration viasetup_method/teardown_method. Running that file alone gives 100% line coverage ofquantecon/timings/timings.pyonmain. The audit checked for a test file per directory rather than by coverage, which is how this slipped through.Criterion 2 (accessor relationship undocumented) was real but small. Removing
get_default_precision()is not an option sincequantecon/util/timing.pycalls it in three places as the read-only accessor. #959 documents the relationship in its docstring.Criterion 3 (doctest examples never run) is being handled more broadly. The only thing that fails under strict doctest is the
print(...)line with no expected output; #959 repairs that single line and keeps the>>>examples so the module is ready for the package-wide docstring sweep in #920.Two PRs were opened against this issue and both authors put in careful work:
Sorry to both of you for the wasted effort here. The issue description sent you after a problem that was already solved, and that is on us, not you.
Generated by Claude Code