summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_mmap.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2016-10-06 05:54:19 (GMT)
committerBenjamin Peterson <benjamin@python.org>2016-10-06 05:54:19 (GMT)
commit87845bcb4ded91fea604ff384090d1a13425599c (patch)
tree0f387f7379afc696c1e14089b099bcc777093891 /Lib/test/test_mmap.py
parenta88614233ea3a5918e0efe39dc5f51e1394fc9c8 (diff)
parent4c8b2cd12650a05d87f3cef7f457bfddaf79c0e0 (diff)
downloadcpython-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.py14
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):