MCPcopy Index your code
hub / github.com/RustPython/RustPython / iter_roundtrip

Method iter_roundtrip

Lib/test/test_buffer.py:2711–2728  ·  view source on GitHub ↗
(ex, m, items, fmt)

Source from the content-addressed store, hash-verified

2709 )
2710
2711 def iter_roundtrip(ex, m, items, fmt):
2712 srcsize = struct.calcsize(fmt)
2713 for bytefmt, to_bytelist in bytespec:
2714
2715 m2 = m.cast(bytefmt)
2716 lst = to_bytelist(ex)
2717 self.verify(m2, obj=ex,
2718 itemsize=1, fmt=bytefmt, readonly=False,
2719 ndim=1, shape=[31*srcsize], strides=(1,),
2720 lst=lst, cast=True)
2721
2722 m3 = m2.cast(fmt)
2723 self.assertEqual(m3, ex)
2724 lst = ex.tolist()
2725 self.verify(m3, obj=ex,
2726 itemsize=srcsize, fmt=fmt, readonly=False,
2727 ndim=1, shape=[31], strides=(srcsize,),
2728 lst=lst, cast=True)
2729
2730 # cast from ndim = 0 to ndim = 1
2731 srcsize = struct.calcsize('I')

Callers

nothing calls this directly

Calls 4

verifyMethod · 0.95
castMethod · 0.45
assertEqualMethod · 0.45
tolistMethod · 0.45

Tested by

no test coverage detected