@@ -147,8 +147,9 @@ def test_compute_hypothesis_test_from_summaries_mismatched_shapes():
147147 )
148148
149149
150- def test_compute_hypothesis_test_from_summaries_observed_larger_than_reference_summaries ():
151- """Test that compute_hypothesis_test_from_summaries raises ValueError if observed is larger than reference."""
150+ def test_compute_hypothesis_test_from_summaries_reference_smaller_than_observed_summaries ():
151+ """Test that compute_hypothesis_test_from_summaries raises ValueError if number of reference summaries smaller than
152+ observed."""
152153 observed_summaries = np .random .rand (20 , 5 )
153154 reference_summaries = np .random .rand (10 , 5 )
154155 num_null_samples = 10
@@ -159,6 +160,30 @@ def test_compute_hypothesis_test_from_summaries_observed_larger_than_reference_s
159160 )
160161
161162
163+ def test_compute_hypothesis_test_from_summaries_num_null_samples_zero ():
164+ """Test that compute_hypothesis_test_from_summaries raises ValueError if num_null_samples is zero."""
165+ observed_summaries = np .random .rand (20 , 5 )
166+ reference_summaries = np .random .rand (10 , 5 )
167+ num_null_samples = 0
168+
169+ with pytest .raises (ValueError ):
170+ bf .diagnostics .metrics .compute_mmd_hypothesis_test_from_summaries (
171+ observed_summaries , reference_summaries , num_null_samples
172+ )
173+
174+
175+ def test_compute_hypothesis_test_from_summaries_num_null_samples_negative ():
176+ """Test that compute_hypothesis_test_from_summaries raises ValueError if num_null_samples is negative."""
177+ observed_summaries = np .random .rand (20 , 5 )
178+ reference_summaries = np .random .rand (10 , 5 )
179+ num_null_samples = - 1
180+
181+ with pytest .raises (ValueError ):
182+ bf .diagnostics .metrics .compute_mmd_hypothesis_test_from_summaries (
183+ observed_summaries , reference_summaries , num_null_samples
184+ )
185+
186+
162187@pytest .mark .parametrize (
163188 "summary_network, is_true_approximator" ,
164189 [(lambda data : data + 1 , True ), (None , True ), (lambda data : data + 1 , False )],
0 commit comments