'Make sure Mosek\'s dual result matches other solvers'

def test_mosek_dual(self):

    if (MOSEK in installed_solvers()):
        constraints = [(self.x == 0)]
        prob = Problem(Minimize(norm(self.x, 1)))
        prob.solve(solver=MOSEK)
        duals_mosek = [x.dual_value for x in constraints]
        prob.solve(solver=ECOS)
        duals_ecos = [x.dual_value for x in constraints]
        self.assertItemsAlmostEqual(duals_mosek, duals_ecos)
        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])) <= 3), (self.x[0] >= 0), (self.x[1] >= 0)]
        prob = Problem(objective, constraints)
        prob.solve(solver=MOSEK)
        duals_mosek = [x.dual_value for x in constraints]
        prob.solve(solver=ECOS)
        duals_ecos = [x.dual_value for x in constraints]
        self.assertItemsAlmostEqual(duals_mosek, duals_ecos)
    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))
