def test_init_exceptions(): # All samplers must be finite sampler1 = mock.MagicMock() sampler2 = mock.MagicMock() sampler1.is_finite.return_value = True sampler2.is_finite.return_value = False with pytest.raises(RuntimeError): multi_sampler = MultiSampler(sampler1, sampler2) with pytest.raises(RuntimeError): MultiSampler()
def multi_sampler(): sampler1 = mock.MagicMock() sampler2 = mock.MagicMock() sampler1.is_finite.return_value = True sampler2.is_finite.return_value = True multi_sampler = MultiSampler(sampler1, sampler2) return multi_sampler
def test_n_samples(): sampler1 = BasicSweep({'a': [1, 2, 3], 'b': [4, 5, 6]}) sampler2 = BasicSweep({'a': [1, 2, 3], 'b': [4, 5, 6]}) multi = MultiSampler(sampler1, sampler2) assert(multi.n_samples() == 81)