'Test pruning constants from constraints.'

def test_prune_constants(self):

    x = Variable(2)
    A = np.matrix('1    2;    3    4')
    constraints = ((A * x) <= 2).canonical_form[1]
    pruned = prune_constants(constraints)
    prod = mul(pruned[0].expr, {})
    self.assertItemsAlmostEqual(prod, np.zeros(A.shape[0]))
    constraints = ((0 * x) <= 2).canonical_form[1]
    pruned = prune_constants(constraints)
    prod = mul(pruned[0].expr, {x.id: 1})
    self.assertItemsAlmostEqual(prod, np.zeros(A.shape[0]))
