mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
Issue #26335: Make mmap.write() return the number of bytes written like
other write methods. Patch by Jakub Stasiak.
This commit is contained in:
parent
d2dc15b26b
commit
6282e656e9
4 changed files with 21 additions and 4 deletions
|
|
@ -713,6 +713,14 @@ class MmapTests(unittest.TestCase):
|
|||
gc_collect()
|
||||
self.assertIs(wr(), None)
|
||||
|
||||
def test_write_returning_the_number_of_bytes_written(self):
|
||||
mm = mmap.mmap(-1, 16)
|
||||
self.assertEqual(mm.write(b""), 0)
|
||||
self.assertEqual(mm.write(b"x"), 1)
|
||||
self.assertEqual(mm.write(b"yz"), 2)
|
||||
self.assertEqual(mm.write(b"python"), 6)
|
||||
|
||||
|
||||
class LargeMmapTests(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue