'Test gradient for geo_mean'

def test_geo_mean(self):

    expr = geo_mean(self.x)
    self.x.value = [1, 2]
    self.assertItemsAlmostEqual(expr.grad[self.x].todense(), [(np.sqrt(2) / 2), ((1.0 / 2) / np.sqrt(2))])
    self.x.value = [0, 2]
    self.assertAlmostEqual(expr.grad[self.x], None)
    expr = geo_mean(self.x, [1, 0])
    self.x.value = [1, 2]
    self.assertItemsAlmostEqual(expr.grad[self.x].todense(), [1, 0])
    self.x.value = [(-1), 2]
    self.assertAlmostEqual(expr.grad[self.x], None)
