-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
Description
Description:
Add pytest unit tests for the Hello Synchrony notebook pipeline to ensure reproducibility.
Context:
Notebooks can silently break. Unit tests with shape checks and golden outputs ensure the pipeline keeps working.
Tasks:
- Create
tests/test_hello_synchrony.py - Test simulated data generation (shapes, dtypes)
- Test synchrony computation (output shapes, value ranges)
- Add "golden output" test: compare against saved expected values
- Integrate with pytest
Acceptance Criteria:
- At least 5 test functions
- Tests cover: data generation, metric computation, output shapes
- Golden output test with tolerance for floating-point
- All tests pass with
pytest tests/test_hello_synchrony.py
Example test structure:
import numpy as np
import pytest
from hypyp import analyses
def test_simulated_data_shape():
data = generate_simulated_data(n_channels=32, n_epochs=10)
assert data[0].shape == (10, 32, 1000) # (epochs, channels, samples)
def test_plv_output_range():
plv = analyses.compute_sync(data, metric='plv')
assert np.all(plv >= 0) and np.all(plv <= 1)
def test_golden_output():
result = run_hello_synchrony_pipeline(seed=42)
expected = np.load('tests/golden/hello_synchrony_expected.npy')
np.testing.assert_allclose(result, expected, rtol=1e-5)Reactions are currently unavailable