Test script for the GNU dbm module (gdbm)

This commit is contained in:
Roger E. Masse 1996-12-17 19:54:27 +00:00
parent 4ca4b07516
commit 62a017c092
2 changed files with 36 additions and 0 deletions

35
Lib/test/test_gdbm.py Executable file
View File

@ -0,0 +1,35 @@
#! /usr/bin/env python
"""Test script for the gdbm module
Roger E. Masse
"""
verbose = 0
if __name__ == '__main__':
verbose = 1
import gdbm
from gdbm import error
filename= '/tmp/delete_me'
g = gdbm.open(filename, 'c')
g['a'] = 'b'
g['12345678910'] = '019237410982340912840198242'
a = g.keys()
if verbose:
print 'Test gdbm file keys: ', a
g.has_key('a')
g.close()
g = gdbm.open(filename, 'r')
g.close()
g = gdbm.open(filename, 'rw')
g.close()
g = gdbm.open(filename, 'w')
g.close()
g = gdbm.open(filename, 'n')
g.close()
try:
import os
os.unlink(filename)
except:
pass

View File

@ -27,6 +27,7 @@ tests = ['test_grammar',
'test_thread',
'test_xdr',
'test_fcntl',
'test_gdbm',
]
if __name__ == '__main__':