def testCallTransitionOperatorMissingExtra(self): def potential(x): return x with self.assertRaisesRegexp(TypeError, 'A common solution is to adjust'): fun_mcmc.call_transition_operator(potential, 0.)
def testCallTransitionOperatorBadArgs(self): def potential(x, y, z): del z return (x, y), () with self.assertRaisesRegexp(TypeError, 'The structure of `new_args=`'): fun_mcmc.call_transition_operator(potential, (1, 2, 3))
def testCallTransitionOperator(self): def kernel(x, y): del y return [x, [1]], () [x, [y]], extra = fun_mcmc.call_transition_operator(kernel, [0., None]) self.assertEqual(0., x) self.assertEqual(1, y) self.assertEqual((), extra)