Retooled the test driver to make use of a descriptor object rather
than a list.
1 parent 9c5d93b commit d842856237a87cfcc8b6b89cdc8c981f36bb55fe
@tundra tundra authored on 19 Mar 2004
Showing 1 changed file
View
68
test-tc.py
#!/usr/bin/env python
# Copyright (c) 2003-2004 TundraWare Inc. All Rights Reserved.
 
PROGNAME = "tconfpy Test Driver"
RCSID = "$Id: test-tc.py,v 1.110 2004/03/14 01:35:23 tundra Exp $"
RCSID = "$Id: test-tc.py,v 1.111 2004/03/20 00:03:54 tundra Exp $"
VERSION = RCSID.split()[2]
 
# Copyright Information
 
items.sort()
 
for val in items:
if isdict:
print val + (15-len(val)) * " " + str(data[val])
d = data[val]
f = "'%s'"
if d.Type != type(f):
f = "%s"
print val + (15-len(val)) * " ", d.Value, " ", d.Writeable, d.Type, f % d.Default, d.LegalVals, d.Min, d.Max
else:
print val
 
print '\n'
 
files = 1
DEBUG = False
 
symtbl = {"foo" : ["val1", True, "s", None, None, None, None],
"baz" : [3, True, "i", None, None, None, None]
}
syms = {"foo" : 1,
"fox" : 1.0,
"bar" : "stringy",
"baz" : 4+5j,
"boo" : True
}
 
#symtbl = {}
symtbl = {}
 
for sym in syms:
 
# Create and init the descriptor
d = tconfpy.VarDescriptor()
d.Value = syms[sym]
d.Type = type(syms[sym])
 
# Set default value according to type
 
for typ in ((tconfpy.TYPE_BOOL, True), (tconfpy.TYPE_COMPLEX, 0+0j),
(tconfpy.TYPE_FLOAT, 0.00), (tconfpy.TYPE_INT, 0),
(tconfpy.TYPE_STRING, "")):
if typ[0] == d.Type:
d.Default = typ[1]
 
# Load the table with this entry
symtbl[sym] = d
 
 
if len(sys.argv) < 2:
print BANNER
print "Usage: test-tc.py [debug] file file ..."