def test_get_potential_slice(self): a = DiscreteFactor([(4, 2), (8, 3)], data=np.array(range(6)).reshape(2, 3)) b = a.get_potential([(8, 0), (9, 1), (2, 4)]) self.assertIsNone(assert_array_almost_equal(b, np.array([0, 3])))
def test_get_potential_single(self): a = DiscreteFactor([(4, 2), (8, 3)], data=np.array(range(6)).reshape(2, 3)) b = a.get_potential([(8, 0), (4, 1), (2, 4)]) print b self.assertAlmostEqual(b, 3)