File: util.py

package info (click to toggle)
python-xml 0.8.4-10.1%2Blenny1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 4,972 kB
  • ctags: 10,628
  • sloc: python: 46,730; ansic: 14,354; xml: 968; makefile: 201; sh: 20
file content (15 lines) | stat: -rw-r--r-- 445 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
def error(msg):
    raise Exception('ERROR: ' + msg)

def testAttribute(elem, attr):
    setattr(elem, attr, 'TEST')
    if getattr(elem, attr) != 'TEST':
        error('get/set of %s failed' % attr)

def testIntAttribute(elem, attr):
    setattr(elem, attr, 1)
    if getattr(elem, attr) != 1:
        error('get/set of %s failed' % attr)
    setattr(elem, attr, 0)
    if getattr(elem, attr) != 0:
        error('get/set of %s failed' % attr)