0
0
mirror of https://github.com/python/cpython.git synced 2024-11-27 23:47:29 +01:00
cpython/Lib/test/test_gdbm.py
Roger E. Masse fab8ab8067 Many scripts, but small changes. Update the way the scripts obtain the
'verbose' flag ala GvR updated test harness architecture.

Old way:

	verbose = 0
	if __name__ == '__main__':
		verbose = 1

New way:

	from test_support import verbose

Some other small readablility and functionality updates.
1996-12-20 22:36:52 +00:00

35 lines
583 B
Python
Executable File

#! /usr/bin/env python
"""Test script for the gdbm module
Roger E. Masse
"""
import gdbm
from gdbm import error
from test_support import verbose
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