'Test adding objectives.'

def test_add_problems(self):

    expr1 = (self.x ** 2)
    expr2 = (self.x ** (-1))
    alpha = 2
    assert (Minimize(expr1) + Minimize(expr2)).is_dcp()
    assert (Maximize((- expr1)) + Maximize((- expr2))).is_dcp()
    with self.assertRaises(DCPError) as cm:
        (Minimize(expr1) + Maximize((- expr2)))
    self.assertEqual(str(cm.exception), 'Problem    does    not    follow    DCP    rules.')
    assert (Minimize(expr1) - Maximize((- expr2))).is_dcp()
    assert (alpha * Minimize(expr1)).is_dcp()
    assert (alpha * Maximize((- expr1))).is_dcp()
    assert ((- alpha) * Maximize((- expr1))).is_dcp()
    assert ((- alpha) * Maximize((- expr1))).is_dcp()
