[Python-checkins] CVS: python/dist/src/Lib/test test_mmap.py,1.4,1.5
A.M. Kuchling
python-dev@python.org
Sat, 17 Jun 2000 21:47:10 -0700
Update of /cvsroot/python/python/dist/src/Lib/test
In directory slayer.i.sourceforge.net:/tmp/cvs-serv25459
Modified Files:
test_mmap.py
Log Message:
Additional tests for seek() method, written by Trent Mick
Index: test_mmap.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mmap.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** test_mmap.py 2000/04/05 14:17:11 1.4
--- test_mmap.py 2000/06/18 04:47:08 1.5
***************
*** 59,63 ****
assert start == PAGESIZE
assert end == PAGESIZE + 6
!
m.close()
os.unlink("foo")
--- 59,98 ----
assert start == PAGESIZE
assert end == PAGESIZE + 6
!
! # test seeking around (try to overflow the seek implementation)
! m.seek(0,0)
! print ' Seek to zeroth byte'
! assert m.tell() == 0
! m.seek(42,1)
! print ' Seek to 42nd byte'
! assert m.tell() == 42
! m.seek(0,2)
! print ' Seek to last byte'
! assert m.tell() == len(m)
!
! print ' Try to seek to negative position...'
! try:
! m.seek(-1)
! except ValueError:
! pass
! else:
! assert 0, 'expected a ValueError but did not get it'
!
! print ' Try to seek beyond end of mmap...'
! try:
! m.seek(1,2)
! except ValueError:
! pass
! else:
! assert 0, 'expected a ValueError but did not get it'
!
! print ' Try to seek to negative position...'
! try:
! m.seek(-len(m)-1,2)
! except ValueError:
! pass
! else:
! assert 0, 'expected a ValueError but did not get it'
!
m.close()
os.unlink("foo")