def assertFullSlice(self, keys, ndim, expected): result = _full_keys(keys, ndim) assert_array_equal(result, tuple(expected)) # Now check that this is actually the numpy behaviour. a = np.empty(range(7, 7 + ndim), dtype=np.bool) msg = 'Full slice produces a different result to numpy.' assert_array_equal(a[keys], a[expected], msg)
def test_expand_too_many(self): with self.assertRaises(IndexError): _full_keys((slice(None), 2, 3), 2)