Add basic test for Ftell() in python

This commit is contained in:
Panu Matilainen 2011-07-11 10:13:00 +03:00
parent 61f5838aa8
commit b4da788fd2
1 changed files with 6 additions and 0 deletions

View File

@ -39,11 +39,17 @@ data = msg * 10
for iot in [ 'fpio', 'fdio', 'ufdio', 'gzdio' ]:
fn = 'pyio.%s' % iot
fd = rpm.fd(fn, 'w', iot)
pos = fd.tell()
if pos != -2 and pos != 0:
myprint('bad start pos %d' % fd.tell())
if fd.write(data) != len(data):
myprint('%s write fail' % iot)
if fn != fd.name:
myprint('bad file name %s' % fd.name)
fd.flush()
pos = fd.tell()
if pos != -2 and pos != len(data):
myprint('bad end pos %d' % fd.tell())
fd = rpm.fd(fn, 'r', iot)
rdata = fd.read()
if rdata != data: