diff options
Diffstat (limited to 'Lib/test/test_mmap.py')
-rw-r--r-- | Lib/test/test_mmap.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_mmap.py b/Lib/test/test_mmap.py index 648da3a..0350b3d 100644 --- a/Lib/test/test_mmap.py +++ b/Lib/test/test_mmap.py @@ -652,6 +652,20 @@ class MmapTests(unittest.TestCase): finally: s.close() + @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), '') + self.assertRaises(ValueError, m.read_byte) + self.assertRaises(ValueError, m.write_byte, 'b') + self.assertRaises(ValueError, m.write, 'abc') + class LargeMmapTests(unittest.TestCase): |