summaryrefslogtreecommitdiff
path: root/source4/scripting/swig/torture/torture_ldb.py
blob: 311a2b1d668704723b202b550f5947c7a6ecff83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/python

import Ldb, sys

def test(cond, msg):
    if not cond:
        print 'FAILED:', msg
        sys.exit(1)

# Torture LdbMessage

m = Ldb.LdbMessage()
m['animal'] = 'dog'
m['name'] = 'spotty'

test(m.keys() == ['animal', 'name'], 'keys() test failed')
test(m.values() == [['dog'], ['spotty']], 'values() test failed')
test(m.items() == [('animal', ['dog']), ('name', ['spotty'])], 'items() test failed')