summaryrefslogtreecommitdiffstats
path: root/Lib/dos-8x3/test_mma.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2000-06-29 19:35:29 (GMT)
committerGuido van Rossum <guido@python.org>2000-06-29 19:35:29 (GMT)
commit3e06ab1d447442a56af739a906546d8d1998dfdc (patch)
tree23145a16354b8b2e59932767c6dc9a5b56bb12cf /Lib/dos-8x3/test_mma.py
parent45cd9de2bb2faa96bb18eb11d20261d7d1b8c20e (diff)
downloadcpython-3e06ab1d447442a56af739a906546d8d1998dfdc.zip
cpython-3e06ab1d447442a56af739a906546d8d1998dfdc.tar.gz
cpython-3e06ab1d447442a56af739a906546d8d1998dfdc.tar.bz2
The usual :)
Diffstat (limited to 'Lib/dos-8x3/test_mma.py')
-rw-r--r--Lib/dos-8x3/test_mma.py37
1 files changed, 36 insertions, 1 deletions
diff --git a/Lib/dos-8x3/test_mma.py b/Lib/dos-8x3/test_mma.py
index e5da187..c3cafca 100644
--- a/Lib/dos-8x3/test_mma.py
+++ b/Lib/dos-8x3/test_mma.py
@@ -58,7 +58,42 @@ def test_both():
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")
print ' Test passed'