Generate random slice tuples for 'shape'.
(ndim, shape, iterations=5)
| 734 | yield rslice(n, allow_empty) |
| 735 | |
| 736 | def rslices_ndim(ndim, shape, iterations=5): |
| 737 | """Generate random slice tuples for 'shape'.""" |
| 738 | # non-empty slices |
| 739 | for _ in range(iterations): |
| 740 | yield tuple(rslice(shape[n]) for n in range(ndim)) |
| 741 | # possibly empty slices |
| 742 | for _ in range(iterations): |
| 743 | yield tuple(rslice(shape[n], allow_empty=True) for n in range(ndim)) |
| 744 | # invalid slices |
| 745 | yield tuple(slice(0,1,0) for _ in range(ndim)) |
| 746 | |
| 747 | def rpermutation(iterable, r=None): |
| 748 | pool = tuple(iterable) |
no test coverage detected
searching dependent graphs…