diff options
Diffstat (limited to 'Lib/test/test_mmap.py')
| -rw-r--r-- | Lib/test/test_mmap.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/test/test_mmap.py b/Lib/test/test_mmap.py index c060e61dda..28b52a98e6 100644 --- a/Lib/test/test_mmap.py +++ b/Lib/test/test_mmap.py @@ -462,11 +462,11 @@ class MmapTests(unittest.TestCase): 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() + 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') |
