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

Method test_getbuffer_empty

Lib/test/test_io/test_memoryio.py:474–486  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

472 self.assertRaises(ValueError, memio.getbuffer)
473
474 def test_getbuffer_empty(self):
475 memio = self.ioclass()
476 buf = memio.getbuffer()
477 self.assertEqual(bytes(buf), b"")
478 # Trying to change the size of the BytesIO while a buffer is exported
479 # raises a BufferError.
480 self.assertRaises(BufferError, memio.write, b'x')
481 buf2 = memio.getbuffer()
482 self.assertRaises(BufferError, memio.write, b'x')
483 buf.release()
484 self.assertRaises(BufferError, memio.write, b'x')
485 buf2.release()
486 memio.write(b'x')
487
488 def test_getbuffer_gc_collect(self):
489 memio = self.ioclass(b"1234567890")

Callers

nothing calls this directly

Calls 6

ioclassMethod · 0.45
getbufferMethod · 0.45
assertEqualMethod · 0.45
assertRaisesMethod · 0.45
releaseMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected