chore: sync main — presentation coverage for print_summary/plot_summary - #283
Merged
Conversation
#260) pipeline-core #316 pruned their relic suite — the ONLY tests anywhere for the analyzer's presentation methods. This adds the coverage in the repo that owns the code (tests/test_statistics_presentation.py, 14 tests): - print_summary: before-analyze guard; CURRENT labels ("Point estimate (tower tip)", the relic still asserted the pre-tower "MAP estimate"); printed values/formats match the summary dict; one HDI line per PINNED mass; call-time stdout resolution (redirect respected). - plot_summary: before-analyze guard returns None; Figure structure (point line at the tip, legend "% HDI" label per pinned mass); show=False/True semantics; bimodal title caveat (flag injected both directions — detection is the tower's contract, not ours); save_path verified by a REAL PNG write (existence + magic bytes + size) — the relic mocked savefig, which is how "silently stops writing files" escapes. Every summary key the methods consume is exercised end-to-end through analyze(), so the next key rename fails here first, not as a KeyError at report-generation time (#260's stated bite). Fix the tests caught (RED-proven): print_summary's `file: TextIO = sys.stdout` default froze the IMPORT-time stream, silently bypassing later redirection (pytest capture, contextlib.redirect_stdout). Now `Optional[TextIO] = None`, resolved to the current sys.stdout at call time. No caller passed `file` explicitly (both repos grepped). Riders: CIC Test Alignment section corrected (it attributed presentation coverage to classes that don't exist — TestPDAPresentation/ TestPDAFailureModes/TestPDAInteractiveSafety); print_summary docstring Example/Note updated to the actual output. Closes #260 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…erage test(statistics): presentation coverage for print_summary/plot_summary (#260)
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.
Brings #282 to main: 14 presentation tests for
PosteriorDistributionAnalyzer.print_summary()/plot_summary()(the #260 gap left by pipeline-core #316's relic-suite pruning), the RED-proven call-time-stdout fix inprint_summary, and the CIC Test Alignment correction.Test/doc change plus one behavior fix that only affects redirected-stdout callers (none exist in either repo); no release needed — next version bump will carry it.
The diff is exactly the just-reviewed #282 content (two adversarial review rounds + fixes, third round clean).
Closes #260
🤖 Generated with Claude Code