Create a random slice of len slicelen that fits into listlen.
(slicelen, listlen)
| 569 | return memlen, itemsize, ndim, shape, strides, offset |
| 570 | |
| 571 | def randslice_from_slicelen(slicelen, listlen): |
| 572 | """Create a random slice of len slicelen that fits into listlen.""" |
| 573 | maxstart = listlen - slicelen |
| 574 | start = randrange(maxstart+1) |
| 575 | maxstep = (listlen - start) // slicelen if slicelen else 1 |
| 576 | step = randrange(1, maxstep+1) |
| 577 | stop = start + slicelen * step |
| 578 | s = slice(start, stop, step) |
| 579 | _, _, _, control = slice_indices(s, listlen) |
| 580 | if control != slicelen: |
| 581 | raise RuntimeError |
| 582 | return s |
| 583 | |
| 584 | def randslice_from_shape(ndim, shape): |
| 585 | """Create two sets of slices for an array x with shape 'shape' |
no test coverage detected
searching dependent graphs…