Added second example of user-defined derived variable descriptor to
show individual attributes being changed in different instances.
1 parent 4cdae7d commit 78ac48d0d8ea5dab6e079ddf4a5defb27353c87f
@tundra tundra authored on 20 Mar 2004
Showing 1 changed file
View
24
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.115 2004/03/20 10:48:03 tundra Exp $"
RCSID = "$Id: test-tc.py,v 1.116 2004/03/20 10:53:09 tundra Exp $"
VERSION = RCSID.split()[2]
 
# Copyright Information
 
 
import tconfpy
import sys
 
# Translate booleans into equivlent writeable state
# Translate booleans into equivalent writeable state
 
TF = {True:"RW", False:"RO"}
 
 
def dumpsymbol(val, d):
 
retval = str(val) + " " * (15 - len(val))
 
for v, p in ((d.Value, 10),
for v, p in ((d.Value, 12),
(TF[d.Writeable], 2),
(str(d.Type).split()[1][1:-2], 7),
(d.Default, 8),
(d.LegalVals, 8),
self.Value = 2-2j
self.Default = 39-4j
self.Type = tconfpy.TYPE_COMPLEX
 
# Instantiate one of these
mc = mycmplx()
# Instantiate some of these
mc1 = mycmplx()
mc2 = mycmplx()
 
# And stuff it in the symbol table
symtbl["MyComplex"] = mc
mc2.Value = 8-3.14159j
mc2.Writeable = False
 
# And stuff them into the symbol table
symtbl["MyComplex1"] = mc1
symtbl["MyComplex2"] = mc2
 
 
# Make sure we got legit arguments