summaryrefslogtreecommitdiff
path: root/Lib/test
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_mmap.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_mmap.py b/Lib/test/test_mmap.py
index bbb4070148..56d85e75f8 100644
--- a/Lib/test/test_mmap.py
+++ b/Lib/test/test_mmap.py
@@ -720,6 +720,20 @@ class MmapTests(unittest.TestCase):
self.assertEqual(mm.write(b"yz"), 2)
self.assertEqual(mm.write(b"python"), 6)
+ @unittest.skipIf(os.name == 'nt', 'cannot resize anonymous mmaps on Windows')
+ def test_resize_past_pos(self):
+ m = mmap.mmap(-1, 8192)
+ self.addCleanup(m.close)
+ m.read(5000)
+ try:
+ m.resize(4096)
+ except SystemError:
+ self.skipTest("resizing not supported")
+ self.assertEqual(m.read(14), b'')
+ self.assertRaises(ValueError, m.read_byte)
+ self.assertRaises(ValueError, m.write_byte, 42)
+ self.assertRaises(ValueError, m.write, b'abc')
+
class LargeMmapTests(unittest.TestCase):