Repository navigation
test: replace shape-only assertions with value checks (Modified/Weighted, #100) - #149
Merged
Merged
Conversation
Closes test-depth gaps 4-6 from #100 in Modified.jl and Weighted.jl: the five bare `isa` checks in the "effect surface" test now compare against closed forms and an inline hazard-reconstruction reference; the two isfinite-only gradient checks now compare ForwardDiff against central finite differences of the same closed form; the isfinite/ tautological-pdf>=0 checks on the numeric quadrature path now compare against a brute-force trapezoidal integral and the pdf = hazard * survival identity; and several bare `isa`/weak-bound checks (a HazardLink round trip, Weighted's scalar and batch rand delegation) now assert exact values instead of type or sign alone. No source changes; all existing and new assertions pass.
Contributor
Try this Pull Request!Option 1: Julia Package ManagerOpen Julia and type: import Pkg
Pkg.activate(temp=true)
Pkg.add(url="https://github.com/EpiAware/ModifiedDistributions.jl", rev="test/depth-modified-weighted-100")
using ModifiedDistributionsOption 2: Local CheckoutIf you have the repo locally: git checkout test/depth-modified-weighted-100
julia --project=. -e "using Pkg; Pkg.instantiate()" |
Codecov Report✅ All modified and coverable lines are covered by tests.
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Contributor
|
📖 Documentation preview is ready! View the docs for this PR at: https://EpiAware.github.io/ModifiedDistributions.jl/previews/PR149/ This preview will be updated automatically when you push new commits. |
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
Closes test-depth gaps 4-6 from #100, scoped to
test/Modified.jlandtest/Weighted.jl.Modified.jl"effect surface" test): the five bare@test modify(...) isa UnivariateDistribution{...}assertions now each carry a value check — the scalar log/identity links compare against their closed forms, the constant callable effect is checked against the scalar log-link result (a constant β(t) = 0.5 is the same proportional-hazards model), and the discrete per-bin cases compare against an inline, independently written hazard→link→PMF reconstruction rather than calling into the package's own helper.@test isfinite(g_lp)/@test isfinite(g_cdf)checks now compare the AD derivative against a central finite difference of the same closed form, for every(base, beta)combination in the loop (previously only one combination was spot-checked this way). Evaluation moved off a sharedx = 3.0to each base's own 90th-percentile point, since a fixedxfell inside a clamped-to-zero density band for one combination, wherelogpdfis-Infand naive finite differences produceNaN.isfinite/bounds/tautologicalpdf >= 0.0checks with a brute-force trapezoidal integral of the modified hazard and thepdf(x) = hazard(x) * survival(x)identity.HazardLink(cloglog) construction check now also asserts it round-trips.Weighted's scalar and batchrand"delegates to the base distribution" tests now assert bit-for-bit equality against an identically-seeded direct call to the base distribution, rather thanisa Real/all(>(0)).No source changes. All existing and new assertions pass (2195 tests, full suite, fresh process).
Bugs found
None. No source-level issues were found while deriving the reference values — every closed form and cross-check matched the existing implementation to numerical tolerance.
Test plan
julia --project=test test/runtests.jl skip_quality— 2195 passed, 0 failed, fresh processModified.jl/Weighted.jlrun — 1398 passedJuliaFormattervia pre-commit hook — passedThis was opened by a bot. Please ping @seabbs for any questions.