Esempio n. 1
0
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()
Esempio n. 2
0
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
Esempio n. 3
0
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)