'Test a basic SOCP with Mosek.'

def test_mosek_socp(self):

    if (MOSEK in installed_solvers()):
        prob = Problem(Minimize(norm(self.x, 2)), [(self.x == 0)])
        prob.solve(solver=MOSEK)
        self.assertAlmostEqual(prob.value, 0)
        self.assertItemsAlmostEqual(self.x.value, [0, 0])
        objective = Minimize((((-4) * self.x[0]) - (5 * self.x[1])))
        constraints = [(((2 * self.x[0]) + self.x[1]) <= 3), (((self.x[0] + (2 * self.x[1])) ** 2) <= 9), (self.x[0] >= 0), (self.x[1] >= 0)]
        prob = Problem(objective, constraints)
        prob.solve(solver=MOSEK)
        self.assertAlmostEqual(prob.value, (-9))
        self.assertItemsAlmostEqual(self.x.value, [1, 1])
        objective = Minimize(self.x[0])
        constraints = [(self.x[0] >= (-100)), (self.x[0] <= (-10)), (self.x[1] == 1)]
        prob = Problem(objective, constraints)
        prob.solve(solver=MOSEK)
        self.assertItemsAlmostEqual(self.x.value, [(-100), 1])
    else:
        with self.assertRaises(Exception) as cm:
            prob = Problem(Minimize(norm(self.x, 1)), [(self.x == 0)])
            prob.solve(solver=MOSEK)
        self.assertEqual(str(cm.exception), ('The    solver    %s    is    not    installed.' % MOSEK))
