summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_gdbm.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_gdbm.py')
-rwxr-xr-xLib/test/test_gdbm.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/Lib/test/test_gdbm.py b/Lib/test/test_gdbm.py
new file mode 100755
index 0000000..d0d705a
--- /dev/null
+++ b/Lib/test/test_gdbm.py
@@ -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