summaryrefslogtreecommitdiff
path: root/Lib/test/test_mmap.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2012-09-29 14:14:19 -0400
committerBenjamin Peterson <benjamin@python.org>2012-09-29 14:14:19 -0400
commit14fb44e1bab9db128770f1d91d244916a669e7c3 (patch)
tree278d9ccc8f819b05f8114c3154087c70b88ed69c /Lib/test/test_mmap.py
parent1764c80925795b6f059e961c5a352c5ece5a7fff (diff)
parent99a247fd01c1cd780c0c3ee1116657627f1ee744 (diff)
downloadcpython-git-14fb44e1bab9db128770f1d91d244916a669e7c3.tar.gz
merge mostly from default
Diffstat (limited to 'Lib/test/test_mmap.py')
-rw-r--r--Lib/test/test_mmap.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_mmap.py b/Lib/test/test_mmap.py
index 2230028f5b..a3de398b9e 100644
--- a/Lib/test/test_mmap.py
+++ b/Lib/test/test_mmap.py
@@ -488,6 +488,15 @@ class MmapTests(unittest.TestCase):
f.flush ()
return mmap.mmap (f.fileno(), 0)
+ def test_empty_file (self):
+ f = open (TESTFN, 'w+b')
+ f.close()
+ with open(TESTFN, "rb") as f :
+ self.assertRaisesRegex(ValueError,
+ "cannot mmap an empty file",
+ mmap.mmap, f.fileno(), 0,
+ access=mmap.ACCESS_READ)
+
def test_offset (self):
f = open (TESTFN, 'w+b')