'Test the constants method.'

def test_constants(self):

    c1 = numpy.random.randn(1, 2)
    c2 = numpy.random.randn(2, 1)
    p = Problem(Minimize((c1 * self.x)), [(self.x >= c2)])
    constants_ = p.constants()
    ref = [c1, c2]
    self.assertEqual(len(ref), len(constants_))
    for (c, r) in zip(constants_, ref):
        self.assertTupleEqual(c.size, r.shape)
        self.assertTrue((c.value == r).all())
    p = Problem(Minimize(self.a), [(self.x >= 1)])
    constants_ = p.constants()
    ref = [numpy.matrix(1)]
    self.assertEqual(len(ref), len(constants_))
    for (c, r) in zip(constants_, ref):
        (self.assertEqual(c.size, r.shape) and self.assertTrue((c.value == r).all()))
