'Test get_problem_data method.'

def test_get_problem_data(self):

    with self.assertRaises(Exception) as cm:
        Problem(Maximize(Bool())).get_problem_data(s.ECOS)
    expected = 'The    solver    ECOS    cannot    solve    the    problem    because    it    cannot    solve    mixed-integer    problems.'
    self.assertEqual(str(cm.exception), expected)
    data = Problem(Maximize((exp(self.a) + 2))).get_problem_data(s.SCS)
    dims = data['dims']
    self.assertEqual(dims['ep'], 1)
    self.assertEqual(data['c'].shape, (2,))
    self.assertEqual(data['A'].shape, (3, 2))
    data = Problem(Minimize((norm(self.x) + 3))).get_problem_data(s.ECOS)
    dims = data['dims']
    self.assertEqual(dims['q'], [3])
    self.assertEqual(data['c'].shape, (3,))
    self.assertEqual(data['A'].shape, (0, 3))
    self.assertEqual(data['G'].shape, (3, 3))
    if (s.CVXOPT in installed_solvers()):
        import cvxopt
        data = Problem(Minimize((norm(self.x) + 3))).get_problem_data(s.CVXOPT)
        dims = data['dims']
        self.assertEqual(dims['q'], [3])
        self.assertEqual(type(data['c']), cvxopt.matrix)
        self.assertEqual(type(data['A']), cvxopt.spmatrix)
        self.assertEqual(data['c'].size, (3, 1))
        self.assertEqual(data['A'].size, (0, 3))
        self.assertEqual(data['G'].size, (3, 3))
