import pytest from opengrowth_privacy_preserving_federated import SecureAggregator def test_mean_and_ci_basic(): agg = SecureAggregator() samples = [1.0, 2.0, 3.0, 4.0, 5.0] for s in samples: agg.add_sample(s) res = agg.aggregate() assert abs(res["mean"] - 3.0) < 1e-9 assert res["ci_low"] <= res["mean"] <= res["ci_high"] def test_no_samples_raises(): agg = SecureAggregator() with pytest.raises(ValueError): agg.aggregate() def test_non_numeric_sample_raises(): agg = SecureAggregator() with pytest.raises(TypeError): agg.add_sample("not-a-number")