Integrate two old_to_integrate tests; harden test discovery#80
Open
torwager wants to merge 2 commits into
Open
Integrate two old_to_integrate tests; harden test discovery#80torwager wants to merge 2 commits into
torwager wants to merge 2 commits into
Conversation
Convert two quarantined standalone scripts into real matlab.unittest tests and move them into the discovered suite, and make the runner robust against non-test files that match the canlab_test_*.m glob. - image_vector/canlab_test_check_roi_extraction.m: converts old_to_integrate/check_roi_extraction.m. The original printed PASS/FAIL but never asserted. Now asserts multi-region 'unique_mask_values' extraction and invariance of the region averages across a write->reload round-trip (RelTol 1e-3 / AbsTol 1e-2 absorbs single-precision NIfTI rounding). Complements canlab_test_extract_roi (single-mask only). - image_vector/canlab_test_resampling_pattern_expression.m: converts old_to_integrate/resampling_pattern_expression_unit_test1.m, which only plotted. Now asserts SIIPS pattern expression is stable (corr > 0.99) across default/nearest/spline resampling; skips if SIIPS is unavailable. - helpers/canlab_safe_suite_from_file.m + canlab_run_all_tests.m: wrap TestSuite.fromFile so a stray non-test canlab_test_*.m is warn-skipped instead of throwing NonTestFile and aborting discovery of the whole suite. - canlab_test_runner_robustness.m: pins that behavior (non-test file -> warn + empty + ok=false; valid file -> loads). Old originals removed from old_to_integrate (jackknife_similarity_unit_test.m stays - it is a characterization/figure script, not a unit test). Full default suite after: 147 passed, 0 failed, 2 incomplete (pre-existing environment skips). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The five xval_*_unit_test.m files at the Unit_tests root were genuine tests (real assertions, no graphics, deterministic, bundled DPSP / synthetic data) but were plain-assert functions named outside the canlab_test_* convention, so the runner never discovered them. Convert each into a functiontests file under a new predictive_model/ subdir: the model is fit once in setupOnce (skipped via assumeTrue if the DPSP sample data is absent) and cached, and the assertions are split into focused test functions using tc.verify* for granular reporting. Behavior preserved. - predictive_model/canlab_test_xval_SVM.m - predictive_model/canlab_test_xval_SVR.m - predictive_model/canlab_test_xval_regression_multisubject.m - predictive_model/canlab_test_xval_regression_multisubject_featureselect.m - predictive_model/canlab_test_xval_discriminant_classifier.m - helpers/canlab_get_dpsp_hot_warm.m: shared DPSP Hot/Warm loader. Old xval_*_unit_test.m removed. New suite: 25 test points, all pass, ~7.5s. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
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.
What
Salvages two of the three quarantined tests in
Unit_tests/old_to_integrate/into the real, discovered suite, and hardens test discovery against the failure mode that put them in quarantine in the first place.Converted + integrated
image_vector/canlab_test_check_roi_extraction.m(fromold_to_integrate/check_roi_extraction.m). The original printedPASS/FAILbut never asserted. Now afunctionteststest that asserts multi-region'unique_mask_values'extraction and invariance of region averages across a write→reload round-trip (RelTol 1e-3 / AbsTol 1e-2absorbs single-precision NIfTI rounding). Complements the existingcanlab_test_extract_roi(single-mask only) — no overlap.image_vector/canlab_test_resampling_pattern_expression.m(fromold_to_integrate/resampling_pattern_expression_unit_test1.m). The original only plotted. Now asserts SIIPS pattern expression is stable (corr > 0.99) across default/nearest/spline resampling; skips gracefully if SIIPS is unavailable.Discovery hardening (the recommended robustness fix)
helpers/canlab_safe_suite_from_file.m+ one-line change incanlab_run_all_tests.m: wrapTestSuite.fromFileso a straycanlab_test_*.mthat is not a valid test (old plain-assert script, or function name ≠ filename) is warn-skipped instead of throwingNonTestFileand aborting discovery of the entire suite.canlab_test_runner_robustness.m: pins that behavior (non-test file → warn + empty +ok=false; valid file → loads). State-independent (useslastwarn, notverifyWarning).Not integrated
old_to_integrate/jackknife_similarity_unit_test.mstays put — it's an 802-line metric-sensitivity characterization/figure script, not a unit test; its only real assertions duplicate the existing jackknife smoke test.Verification
Full default suite (walkthroughs excluded): 147 passed, 0 failed, 2 incomplete locally. The 4 new tests are discovered and pass; the 2 incompletes are pre-existing environment skips. No regressions.
🤖 Generated with Claude Code