def test_choose_backend_shortcut(self): backend = mock.Mock() shortcuts = {'test_backend': {'backend': backend, 'name': None}} sampling._choose_backend('test_backend', 'chain', shortcuts=shortcuts) self.assertTrue(backend.called)
def test_choose_backend_list_of_variables(self): with mock.patch('pymc3.sampling.NDArray') as nd: sampling._choose_backend(['var1', 'var2'], 'chain') nd.assert_called_with(vars=['var1', 'var2'])
def test_choose_backend_none(self): with mock.patch('pymc3.sampling.NDArray') as nd: sampling._choose_backend(None, 'chain') self.assertTrue(nd.called)