assert isinstance(key, slice) a = [1, 2, 3] start, stop, step = key.indices(a.len()) assert a[start:stop:step] == a[key]