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

Method buffer_like_objects

Lib/test/pickletester.py:4331–4349  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

4329 #
4330
4331 def buffer_like_objects(self):
4332 # Yield buffer-like objects with the bytestring "abcdef" in them
4333 bytestring = b"abcdefgh"
4334 yield ZeroCopyBytes(bytestring)
4335 yield ZeroCopyBytearray(bytestring)
4336 if _testbuffer is not None:
4337 items = list(bytestring)
4338 value = int.from_bytes(bytestring, byteorder='little')
4339 for flags in (0, _testbuffer.ND_WRITABLE):
4340 # 1-D, contiguous
4341 yield PicklableNDArray(items, format='B', shape=(8,),
4342 flags=flags)
4343 # 2-D, C-contiguous
4344 yield PicklableNDArray(items, format='B', shape=(4, 2),
4345 strides=(2, 1), flags=flags)
4346 # 2-D, Fortran-contiguous
4347 yield PicklableNDArray(items, format='B',
4348 shape=(4, 2), strides=(1, 4),
4349 flags=flags)
4350
4351 def test_in_band_buffers(self):
4352 # Test in-band buffers (PEP 574)

Callers 2

test_in_band_buffersMethod · 0.95
test_oob_buffersMethod · 0.95

Calls 4

ZeroCopyBytesClass · 0.85
ZeroCopyBytearrayClass · 0.85
listClass · 0.85
PicklableNDArrayClass · 0.85

Tested by

no test coverage detected