summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_mmap.py
diff options
context:
space:
mode:
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 2230028..404f1e8 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()
+ f = open(TESTFN, "rb")
+ self.assertRaisesRegex(ValueError,
+ "cannot mmap an empty file",
+ mmap.mmap, f.fileno(), 0, access=mmap.ACCESS_READ)
+ f.close()
+
def test_offset (self):
f = open (TESTFN, 'w+b')