MCPcopy Index your code
hub / github.com/python/cpython / test_ndarray_format_strides

Method test_ndarray_format_strides

Lib/test/test_buffer.py:1346–1365  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1344 lst=items)
1345
1346 def test_ndarray_format_strides(self):
1347 # ndim = 1, strides
1348 nitems = randrange(1, 30)
1349 for fmt, items, _ in iter_format(nitems):
1350 itemsize = struct.calcsize(fmt)
1351 for step in range(-5, 5):
1352 if step == 0:
1353 continue
1354
1355 shape = [len(items[::step])]
1356 strides = [step*itemsize]
1357 offset = itemsize*(nitems-1) if step < 0 else 0
1358
1359 for flags in (0, ND_PIL):
1360 nd = ndarray(items, shape=shape, strides=strides,
1361 format=fmt, offset=offset, flags=flags)
1362 self.verify(nd, obj=None,
1363 itemsize=itemsize, fmt=fmt, readonly=True,
1364 ndim=1, shape=shape, strides=strides,
1365 lst=items[::step])
1366
1367 def test_ndarray_fortran(self):
1368 items = [1,2,3,4,5,6,7,8,9,10,11,12]

Callers

nothing calls this directly

Calls 2

verifyMethod · 0.95
iter_formatFunction · 0.85

Tested by

no test coverage detected