def test_low_n_ess_warning(self): n_particles = 1000 updater = self._mk_updater(n_particles, resample_thresh=0.0) outcomes = np.array([0], dtype=int) expparams = np.ones((1,), dtype=self.model.expparams_dtype) expparams['alpha'][0] = 2 / 1000 # Force the particle number to be 2. with assert_warns(ApproximationWarning): updater.update(outcomes, expparams)
def test_assert_warns_nowarn(self): with assert_warns(RuntimeWarning): pass
def test_assert_warns_ok(self): with assert_warns(RuntimeWarning): warnings.warn(RuntimeWarning("Test"))