diff options
author | Fred Drake <fdrake@acm.org> | 2001-05-11 14:29:21 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2001-05-11 14:29:21 (GMT) |
commit | 6278799f8e34bf01de68f989f5f100913fb5e2f5 (patch) | |
tree | 2530b21e671837888d38d4df6818b15be6a96487 /Lib/test/test_mmap.py | |
parent | 5acbfcc1645fbaecff987460c4933731466d8d64 (diff) | |
download | cpython-6278799f8e34bf01de68f989f5f100913fb5e2f5.zip cpython-6278799f8e34bf01de68f989f5f100913fb5e2f5.tar.gz cpython-6278799f8e34bf01de68f989f5f100913fb5e2f5.tar.bz2 |
unlink() would normally be found in the "os" module, so use it from there.
Remove unused import of "sys".
If the file TESTFN exists before we start, try to remove it.
Add spaces around the = in some assignments.
Diffstat (limited to 'Lib/test/test_mmap.py')
-rw-r--r-- | Lib/test/test_mmap.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Lib/test/test_mmap.py b/Lib/test/test_mmap.py index 427f4e6..eb31dc3 100644 --- a/Lib/test/test_mmap.py +++ b/Lib/test/test_mmap.py @@ -1,6 +1,6 @@ -from test_support import verify, TESTFN, unlink +from test_support import verify, TESTFN import mmap -import os, re, sys +import os, re PAGESIZE = mmap.PAGESIZE @@ -8,6 +8,8 @@ def test_both(): "Test mmap module on Unix systems and Windows" # Create a file to be mmap'ed. + if os.path.exists(TESTFN): + os.unlink(TESTFN) f = open(TESTFN, 'w+') try: # unlink TESTFN no matter what @@ -36,7 +38,7 @@ def test_both(): # Modify the file's content print "\n Modifying file's content..." m[0] = '3' - m[PAGESIZE +3: PAGESIZE +3+3]='bar' + m[PAGESIZE +3: PAGESIZE +3+3] = 'bar' # Check that the modification worked print ' Contents of byte 0:', repr(m[0]) @@ -49,7 +51,7 @@ def test_both(): m.flush() # Test doing a regular expression match in an mmap'ed file - match=re.search('[A-Za-z]+', m) + match = re.search('[A-Za-z]+', m) if match is None: print ' ERROR: regex match on mmap failed!' else: @@ -126,7 +128,7 @@ def test_both(): except OSError: pass try: - unlink(TESTFN) + os.unlink(TESTFN) except OSError: pass |