def test_multiple_samplers(self, caplog): with Model(): prob = Beta("prob", alpha=5.0, beta=3.0) Binomial("outcome", n=1, p=prob) caplog.clear() sample(3, tune=2, discard_tuned_samples=False, n_init=None, chains=1) messages = [msg.msg for msg in caplog.records] assert all("boolean index did not" not in msg for msg in messages)
def test_multiple_samplers(self): with Model(): prob = Beta('prob', alpha=5, beta=3) Binomial('outcome', n=1, p=prob) with warnings.catch_warnings(record=True) as warns: sample(3, tune=2, discard_tuned_samples=False, n_init=None) messages = [warn.message.args[0] for warn in warns] assert any("contains only 3" in msg for msg in messages) assert all('boolean index did not' not in msg for msg in messages)
def test_multiple_samplers(self): with Model(): prob = Beta('prob', alpha=5., beta=3.) Binomial('outcome', n=1, p=prob) # Catching warnings through multiprocessing doesn't work, # so we have to use single threaded sampling. with pytest.warns(None) as warns: sample(3, tune=2, discard_tuned_samples=False, n_init=None, chains=1) messages = [warn.message.args[0] for warn in warns] assert any("contains only 3" in msg for msg in messages) assert all('boolean index did not' not in msg for msg in messages)