diff options
author | Benjamin Peterson <benjamin@python.org> | 2016-10-06 05:54:19 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2016-10-06 05:54:19 (GMT) |
commit | 87845bcb4ded91fea604ff384090d1a13425599c (patch) | |
tree | 0f387f7379afc696c1e14089b099bcc777093891 /Lib/test/test_mmap.py | |
parent | a88614233ea3a5918e0efe39dc5f51e1394fc9c8 (diff) | |
parent | 4c8b2cd12650a05d87f3cef7f457bfddaf79c0e0 (diff) | |
download | cpython-87845bcb4ded91fea604ff384090d1a13425599c.zip cpython-87845bcb4ded91fea604ff384090d1a13425599c.tar.gz cpython-87845bcb4ded91fea604ff384090d1a13425599c.tar.bz2 |
merge 3.5
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 bbb4070..56d85e7 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): |