'Test error when P is symmetric but not definite.'

def test_non_psd(self):

    P = np.array([[1, 0], [0, (-1)]])
    x = cvxpy.Variable(2)
    with warnings.catch_warnings():
        warnings.simplefilter('ignore')
        cost = cvxpy.quad_form(x, P)
    prob = cvxpy.Problem(cvxpy.Minimize(cost), [(x == [1, 2])])
    with self.assertRaises(Exception) as cm:
        prob.solve()
    self.assertEqual(str(cm.exception), 'Problem    does    not    follow    DCP    rules.')
