'Test indexing with lists/ndarrays of indices.'

def test_selector_list_indices(self):

    A = np.array([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]])
    C = Constant(A)
    expr = C[[1, 2]]
    self.assertEqual(expr.size, (2, 4))
    self.assertEqual(expr.sign, s.POSITIVE)
    self.assertItemsAlmostEqual(A[[1, 2]], expr.value)
    expr = C[([0, 2], 3)]
    self.assertEqual(expr.size, (2, 1))
    self.assertEqual(expr.sign, s.POSITIVE)
    self.assertItemsAlmostEqual(A[([0, 2], 3)], expr.value)
    expr = C[(1, [0, 2])]
    self.assertEqual(expr.size, (2, 1))
    self.assertEqual(expr.sign, s.POSITIVE)
    self.assertItemsAlmostEqual(A[(1, [0, 2])], expr.value)
    expr = C[[0, 2], 1:3]
    self.assertEqual(expr.size, (2, 2))
    self.assertEqual(expr.sign, s.POSITIVE)
    self.assertItemsAlmostEqual(A[[0, 2], 1:3], expr.value)
    expr = C[1:(-1), [0, 2]]
    self.assertEqual(expr.size, (1, 2))
    self.assertEqual(expr.sign, s.POSITIVE)
    self.assertItemsAlmostEqual(A[1:(-1), [0, 2]], expr.value)
    expr = C[([0, 1], [1, 3])]
    self.assertEqual(expr.size, (2, 1))
    self.assertEqual(expr.sign, s.POSITIVE)
    self.assertItemsAlmostEqual(A[([0, 1], [1, 3])], expr.value)
    expr = C[(np.array([0, 1]), [1, 3])]
    self.assertEqual(expr.size, (2, 1))
    self.assertEqual(expr.sign, s.POSITIVE)
    self.assertItemsAlmostEqual(A[(np.array([0, 1]), [1, 3])], expr.value)
    expr = C[(np.array([0, 1]), np.array([1, 3]))]
    self.assertEqual(expr.size, (2, 1))
    self.assertEqual(expr.sign, s.POSITIVE)
    self.assertItemsAlmostEqual(A[(np.array([0, 1]), np.array([1, 3]))], expr.value)
