'Test the diag atom.'

def test_diag(self):

    expr = diag(self.x)
    self.assertEqual(expr.sign, s.UNKNOWN)
    self.assertEqual(expr.curvature, s.AFFINE)
    self.assertEqual(expr.size, (2, 2))
    expr = diag(self.A)
    self.assertEqual(expr.sign, s.UNKNOWN)
    self.assertEqual(expr.curvature, s.AFFINE)
    self.assertEqual(expr.size, (2, 1))
    expr = diag(self.x.T)
    self.assertEqual(expr.sign, s.UNKNOWN)
    self.assertEqual(expr.curvature, s.AFFINE)
    self.assertEqual(expr.size, (2, 2))
    with self.assertRaises(Exception) as cm:
        diag(self.C)
    self.assertEqual(str(cm.exception), 'Argument    to    diag    must    be    a    vector    or    square    matrix.')
