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

Method iter_roundtrip

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

Source from the content-addressed store, hash-verified

2721 )
2722
2723 def iter_roundtrip(ex, m, items, fmt):
2724 srcsize = struct.calcsize(fmt)
2725 for bytefmt, to_bytelist in bytespec:
2726
2727 m2 = m.cast(bytefmt)
2728 lst = to_bytelist(ex)
2729 self.verify(m2, obj=ex,
2730 itemsize=1, fmt=bytefmt, readonly=False,
2731 ndim=1, shape=[31*srcsize], strides=(1,),
2732 lst=lst, cast=True)
2733
2734 m3 = m2.cast(fmt)
2735 self.assertEqual(m3, ex)
2736 lst = ex.tolist()
2737 self.verify(m3, obj=ex,
2738 itemsize=srcsize, fmt=fmt, readonly=False,
2739 ndim=1, shape=[31], strides=(srcsize,),
2740 lst=lst, cast=True)
2741
2742 # cast from ndim = 0 to ndim = 1
2743 srcsize = struct.calcsize('I')

Callers

nothing calls this directly

Calls 3

verifyMethod · 0.95
castMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected