Repository navigation
Add CLI/edge-case tests and small robustness fixes - #1
Merged
Merged
Conversation
- Cover mcl.cli (was 0%): parser defaults, history CSV round-trip/error, main via fakes - _encode_labels: use np.unique(..., return_inverse=True).ravel() so numeric labels keep numeric order (LabelEncoder on stringified labels reordered e.g. 1,2,10) - to_numpy3d: clear ValueError on empty DataFrames instead of IndexError - _save_history: report write errors via SystemExit instead of a raw traceback - mixup_batch: draw lam from torch.distributions.Beta so a single torch.manual_seed makes runs reproducible - CI: add pytest-cov with --cov-fail-under=90
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
Small hardening pass: tests for the previously-uncovered CLI plus a few real robustness fixes. No behavior change for normal use.
Changes
cli.pywas 0% covered. Addedtests/test_cli.py(parser defaults, history CSV round-trip/error,mainvia fakes) plus extradata.py/trainer.pyedge cases (Series input, empty frames, label ordering, verbose logging)._encode_labels: usenp.unique(..., return_inverse=True)so numeric labels keep numeric order (the oldLabelEncoderon stringified labels reordered e.g.1,2,10).to_numpy3d: raise a clearValueErroron empty DataFrames instead ofIndexError._save_history: report write errors viaSystemExitinstead of a raw traceback.mixup_batch: drawlamfromtorch.distributions.Betaso a singletorch.manual_seedmakes runs reproducible.pytest-covwith--cov-fail-under=90.Verification
pytest --cov=mcl→ 42 passed, 2 skipped, 98.7% coverage;ruff check/format --checkclean.