[Python-checkins] CVS: python/dist/src/Lib/test test_mmap.py,1.16,1.17

Fred L. Drake fdrake@users.sourceforge.net
Fri, 11 May 2001 07:29:23 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv14505/Lib/test

Modified Files:
	test_mmap.py 
Log Message:

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.


Index: test_mmap.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mmap.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -r1.16 -r1.17
*** test_mmap.py	2001/05/10 20:03:04	1.16
--- test_mmap.py	2001/05/11 14:29:21	1.17
***************
*** 1,5 ****
! from test_support import verify, TESTFN, unlink
  import mmap
! import os, re, sys
  
  PAGESIZE = mmap.PAGESIZE
--- 1,5 ----
! from test_support import verify, TESTFN
  import mmap
! import os, re
  
  PAGESIZE = mmap.PAGESIZE
***************
*** 9,12 ****
--- 9,14 ----
  
      # Create a file to be mmap'ed.
+     if os.path.exists(TESTFN):
+         os.unlink(TESTFN)
      f = open(TESTFN, 'w+')
  
***************
*** 37,41 ****
          print "\n  Modifying file's content..."
          m[0] = '3'
!         m[PAGESIZE +3: PAGESIZE +3+3]='bar'
  
          # Check that the modification worked
--- 39,43 ----
          print "\n  Modifying file's content..."
          m[0] = '3'
!         m[PAGESIZE +3: PAGESIZE +3+3] = 'bar'
  
          # Check that the modification worked
***************
*** 50,54 ****
  
          # Test doing a regular expression match in an mmap'ed file
!         match=re.search('[A-Za-z]+', m)
          if match is None:
              print '  ERROR: regex match on mmap failed!'
--- 52,56 ----
  
          # Test doing a regular expression match in an mmap'ed file
!         match = re.search('[A-Za-z]+', m)
          if match is None:
              print '  ERROR: regex match on mmap failed!'
***************
*** 127,131 ****
              pass
          try:
!             unlink(TESTFN)
          except OSError:
              pass
--- 129,133 ----
              pass
          try:
!             os.unlink(TESTFN)
          except OSError:
              pass