Skip to content

Commit 19945eb

Browse files
Test cov minibatch (#252)
* TST cover runtime error in minibatch * CI update codecov version * MNT avoid using flat badge
1 parent 0b3928d commit 19945eb

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
pixi run -e dev test-coverage xml
5858
- name: Upload coverage reports to Codecov
5959
if: matrix.os == 'ubuntu-latest'
60-
uses: codecov/codecov-action@v5
60+
uses: codecov/codecov-action@v7
6161
with:
6262
token: ${{ secrets.CODECOV_TOKEN }}
6363
verbose: true

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ fastcan: A fast canonical-correlation-based search algorithm
2323
.. |ruff| image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
2424
:target: https://github.com/astral-sh/ruff
2525

26-
.. |pixi| image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/prefix-dev/pixi/main/assets/badge/v0.json&style=flat-square
26+
.. |pixi| image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/prefix-dev/pixi/main/assets/badge/v0.json
2727
:target: https://pixi.sh
2828

29-
.. |asv| image:: https://img.shields.io/badge/benchmarked%20by-asv-blue.svg?style=flat
29+
.. |asv| image:: https://img.shields.io/badge/benchmarked%20by-asv-blue.svg
3030
:target: https://contrib.scikit-learn.org/fastcan/
3131

3232
.. |ty| image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ty/main/assets/badge/v0.json

fastcan/tests/test_minibatch.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,12 @@ def test_minibatch_ssc_aligned(capsys):
118118
f"Progress: {n_to_select}/{n_to_select}, "
119119
f"Batch SSC: {gtruth_ssc:.5f}" in captured.out
120120
)
121+
122+
123+
def test_minibatch_runtime_error():
124+
# Test RuntimeError branch when not enough features can form a non-singular matrix
125+
X = np.array([[1.0, 1.0], [2.0, 2.0], [3.0, 3.0], [4.0, 4.0]])
126+
y = np.array([1.0, 2.0, 3.0, 4.0])
127+
128+
indices = minibatch(X, y, n_features_to_select=2, batch_size=2, verbose=0)
129+
assert len(np.unique(indices)) == 2

0 commit comments

Comments
 (0)