@@ -42,17 +42,8 @@ pytest tests/unit/test_bids_parsing.py
4242pytest tests/unit/test_bids_parsing.py::test_parse_subject_id
4343```
4444
45- ### Before Committing
46-
47- ``` bash
48- # Run unit + integration (skip slow tests)
49- pytest -m " not slow and not full_pipeline"
50-
51- # With coverage report
52- pytest -m " not slow and not full_pipeline" --cov=src --cov-report=term-missing
53- ```
54-
55- ## Useful Options
45+ <details >
46+ <summary ><h2 >Useful Options</h2 ></summary >
5647
5748``` bash
5849# Stop on first failure
@@ -65,64 +56,12 @@ pytest --durations=10
6556pytest -k " motion_correction"
6657```
6758
59+ </details >
60+
6861## Test Data
6962
7063Test data is stored in ` tests/data/ ` .
7164
72- ## Writing Tests
73-
74- ### Unit Test (Fast)
75-
76- ``` python
77- import pytest
78-
79- @pytest.mark.unit
80- def test_parse_bids_filename ():
81- """ Test BIDS filename parsing."""
82- filename = " sub-01_task-rest_bold.nii.gz"
83- result = parse_bids_filename(filename)
84-
85- assert result[" sub" ] == " 01"
86- assert result[" task" ] == " rest"
87- ```
88-
89- ### Integration Test (Uses Real Data)
90-
91- ``` python
92- import pytest
93-
94- @pytest.mark.integration
95- def test_motion_correction (sample_bold , temp_dir ):
96- """ Test motion correction with real data."""
97- output = temp_dir / " corrected.nii.gz"
98-
99- motion_correct(sample_bold, output)
100-
101- assert output.exists()
102- img = nib.load(output)
103- assert img.shape[3 ] == 50 # Same number of volumes
104- ```
105-
106- ## Available Fixtures
107-
108- ``` python
109- # Mock data (fast, for unit tests)
110- def test_with_mock_data (mock_bold_image ):
111- # Uses synthetic 10x10x10x5 volume
112- pass
113-
114- # Real data (for integration tests)
115- def test_with_real_data (sample_bold ):
116- # Uses actual 50-volume BOLD scan
117- pass
118-
119- # Temporary directory
120- def test_with_temp_dir (temp_dir ):
121- # Cleaned up automatically after test
122- output = temp_dir / " result.nii.gz"
123- pass
124- ```
125-
12665## Coverage Requirements
12766
12867- ** Overall:** >85%
0 commit comments