Add unit tests for alignPlots() and the getTIS/getRIC/plotTIS/plotRIC family - #50
Merged
Merged
Conversation
… family - alignPlots(): tests the three returned ggplot objects (rt/dt correction plots and the dt_kcorr plot) for labels and expected data, using the align() fixture already in this file. - getTIS()/getRIC(): tests the extracted TIS/RIC matrices' shape and SampleID-keyed dimnames. - plotTIS()/plotRIC(): tests labels, data, and the dt_range/rt_range and sample= filtering, following the same "inspect the returned ggplot object, don't render it" strategy used for the other plot functions. Registering BiocParallel::SerialParam() locally in two tests (instead of the default forking MulticoreParam) runs the per-sample delayed operation in the same process, letting covr instrument .align_fun_extract()'s dt_kcorr fallback and .extract_RIC_and_TIS_fun_extract() -- both already exercised by existing/new tests, just invisible to covr inside a forked worker until now. Brings getTIS_getRIC-GCIMSDataset.R to 100% line coverage, and align-GCIMSDataset.R to 97.5% (116/119) -- the remaining 3 lines are the "pow" package's optional reference-selection call (needs that package installed) and two eval_poly() branches inside alignPlots() that are dead code given its only caller always passes a 2-column matrix. Overall package coverage: 86.83% -> 90.21%. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019V3CHRGSzcEu3k6tpUFv56
Registers BiocParallel::SerialParam() locally in tests that exercise realize_one_sample_disk()/realize_one_sample_ram(), which normally run inside forked bpmapply() workers invisible to covr. Adds direct unit tests of realize_one_sample_disk() for the file.copy fallback path (unreachable via the public API), mocked file.copy()/unlink() failures in updateScratchDir()/subset(), and R6-private-access tests for the directory-vanished and no-pending-ops edge cases. Also covers DelayedDatasetRAM's unnamed-samples-list guard, sampleNames<- length-mismatch guard, and the wrong-return-class abort, plus DelayedDatasetBase's realize() reentrancy guard.
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
alignPlots(): tests the three returned ggplot objects (rt/dt correction plots and the dt_kcorr plot) for labels and expected data, reusing the existingalign()fixture intest-align-GCIMSDataset.R.getTIS()/getRIC(): tests the extracted TIS/RIC matrices' shape and SampleID-keyed dimnames.plotTIS()/plotRIC(): tests labels, data, and thedt_range/rt_rangeandsample=filtering — same "inspect the returned ggplot object, don't render it" strategy used for the other plot functions in Add unit tests for the plotting functions; fix scales >= 1.3.0 compatibility #49.A useful technique for BiocParallel-forked code
Registering
BiocParallel::SerialParam()locally in a test (instead of the default forkingMulticoreParam) runs a delayed operation's per-sample step in the same process, lettingcovrinstrument code that would otherwise run invisibly inside a forked worker. Used this for two tests here to unlock coverage on.align_fun_extract()'sdt_kcorrfallback and.extract_RIC_and_TIS_fun_extract()— both were already being exercised by existing/new tests, just invisible tocovruntil now. This is likely reusable for the similar BiocParallel-fork gaps noted in earlier coverage PRs (e.g. inaaa-class-DelayedDatasetDisk.R).Brings
getTIS_getRIC-GCIMSDataset.Rto 100% line coverage, andalign-GCIMSDataset.Rto 97.5% (116/119) — the remaining 3 lines are thepowpackage's optional reference-selection call (needs that package installed) and twoeval_poly()branches insidealignPlots()that are dead code given its only caller always passes a 2-column matrix.Overall package coverage: 86.83% → 90.21%.
Test plan
testthat::test_local(".")— 701 passing, 1 pre-existing skip, 0 failurescovr::package_coverage()confirms the reported numbersGenerated by Claude Code