diff options
Diffstat (limited to 'Lib/test/test_bsddb.py')
-rwxr-xr-x | Lib/test/test_bsddb.py | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/Lib/test/test_bsddb.py b/Lib/test/test_bsddb.py index aa58ef8..87145fb 100755 --- a/Lib/test/test_bsddb.py +++ b/Lib/test/test_bsddb.py @@ -20,12 +20,24 @@ def test(openmethod, what, ondisk=1): verify(f.keys() == []) if verbose: print 'creation...' - f['0'] = '' - f['a'] = 'Guido' - f['b'] = 'van' - f['c'] = 'Rossum' - f['d'] = 'invented' - f['f'] = 'Python' + keys = ['0', 'a', 'b', 'c', 'd', 'e', 'f'] + values = ['', 'Guido', 'van', 'Rossum', 'invented', 'Python'] + items = zip(keys, values) + for k, v in items: + f[k] = v + + # test mapping iteration methods + from sets import Set + def verifyset(s1, s2): + verify(Set(s1) == Set(s2)) + verify(keys, f.keys()) + verify(values, f.values()) + verify(items, f.items()) + verify(keys, f) + verify(keys, f.iterkeys()) + verify(values, f.itervalues()) + verify(items, f.iteritems()) + if verbose: print '%s %s %s' % (f['a'], f['b'], f['c']) |