def dispatcher(self): shot = self.shot+1 with Tree(self.tree,shot,'new') as pytree: Device.PyDevice('TestDevice').Add(pytree,'TESTDEVICE_I') Device.PyDevice('TestDevice').Add(pytree,'TESTDEVICE_S',add_source=True) pytree.write() monitor,monitor_port = self._setup_mdsip('ACTION_MONITOR','MONITOR_PORT',7010+self.index,False) monitor_opt = "/monitor=%s"%monitor if monitor_port>0 else "" server ,server_port = self._setup_mdsip('ACTION_SERVER', 'ACTION_PORT',7000+self.index,True) pytree.normal() pytree.TESTDEVICE_I.ACTIONSERVER.no_write_shot = False pytree.TESTDEVICE_I.ACTIONSERVER.record = server pytree.TESTDEVICE_S.ACTIONSERVER.no_write_shot = False pytree.TESTDEVICE_S.ACTIONSERVER.record = server """ using dispatcher """ mon,mon_log,svr,svr_log = (None,None,None,None) try: mon,mon_log = self._start_mdsip(monitor,monitor_port,'monitor') svr,svr_log = self._start_mdsip(server ,server_port ,'dispatcher') try: if mon: self.assertEqual(mon.poll(),None) if svr: self.assertEqual(svr.poll(),None) #Connection(server).get("""py("MDSplus.Device.PyDevice('TestDevice')","None")""") """ tcl dispatch """ self._testDispatchCommand(server,'type test') self._doTCLTest('set tree pytree/shot=%d'%shot) #if not self.in_valgrind: # self._doTCLTest('dispatch TESTDEVICE_S:ACTIONSERVER:MANUAL') # self._waitIdle(server,3) #else: # sys.stdout.write("VALGRIND: skipping 'dispatch TESTDEVICE_S:ACTIONSERVER:MANUAL'\n") # sys.stdout.flush() self._doTCLTest('dispatch/build%s'%monitor_opt) self._doTCLTest('dispatch/phase%s INIT'%monitor_opt) self._waitIdle(server,3) self._doTCLTest('dispatch/phase%s PULSE'%monitor_opt) self._waitIdle(server,3) self._doTCLTest('dispatch/phase%s STORE'%monitor_opt) self._waitIdle(server,3) """ tcl exceptions """ self._doExceptionTest('dispatch/command/server=%s '%server,Exc.MdsdclIVVERB) """ tcl check if still alive """ if mon: self.assertEqual(mon.poll(),None) if svr: self.assertEqual(svr.poll(),None) finally: self._stop_mdsip((svr,server),(mon,monitor)) finally: if svr_log: svr_log.close() if mon_log: mon_log.close() self._doTCLTest('close/all') pytree.readonly() #if not self.in_valgrind: # self.assertTrue(pytree.TESTDEVICE_S.MANUAL_DONE.record<= pytree.TESTDEVICE_S.INIT1_DONE.record) self.assertTrue(pytree.TESTDEVICE_I.INIT1_DONE.record <= pytree.TESTDEVICE_I.INIT2_DONE.record) self.assertTrue(pytree.TESTDEVICE_S.INIT1_DONE.record <= pytree.TESTDEVICE_S.INIT2_DONE.record) self.assertTrue(pytree.TESTDEVICE_I.INIT2_DONE.record <= pytree.TESTDEVICE_I.STORE_DONE.record) self.assertTrue(pytree.TESTDEVICE_S.INIT2_DONE.record <= pytree.TESTDEVICE_S.STORE_DONE.record) self.assertEqual(pytree.TESTDEVICE_I.CHANNEL.data().tolist(),[0,1,2,3,4,5,6,7,8,9]) self.assertEqual(pytree.TESTDEVICE_S.CHANNEL.data().tolist(),[0,1,2,3,4,5,6,7,8,9])
def test(): with Tree('pytree', self.shot, 'new') as pytree: if pytree.shot != self.shot: raise Exception( "Shot number changed! tree.shot=%d, thread.shot=%d" % (pytree.shot, self.shot)) pytree.default.addNode('pytreesub', 'subtree').include_in_pulse = True for i in range(10): node = pytree.addNode('val%02d' % (i, ), 'numeric') node.record = i node = pytree.top.addNode('sig%02d' % (i, ), 'signal') node.record = Signal(i, None, i) node = pytree.top.addNode('child%02d' % (i, ), 'structure') node.addNode('text', 'text') node.addNode('child', 'structure') node = pytree.addNode('SIG_CMPRS', 'signal') node.compress_on_put = True Device.PyDevice('TestDevice').Add(pytree, 'TESTDEVICE') Device.PyDevice('CYGNET4K').Add(pytree, 'CYGNET4K').on = False pytree.write() with Tree('pytreesub', self.shot, 'new') as pytreesub: if pytreesub.shot != self.shot: raise Exception( "Shot number changed! tree.shot=%d, thread.shot=%d" % (pytreesub.shot, self.shot)) pytreesub_top = pytreesub.default node = pytreesub_top.addNode('.rog', 'structure') for i in range(10): node = node.addNode('.child', 'structure') node = node.addNode('rogowski', 'structure') node.tag = 'MAG_ROGOWSKI' node = node.addNode('signals', 'structure') node = node.addNode('rog_fg', 'signal') node.record = Signal(Range(1., 1000.), None, Range(1., 100., .1)) node = pytreesub_top.addNode('btor', 'signal') node.tag = 'BTOR' node.compress_on_put = True node.record = Signal(Range(2., 2000., 2.), None, Range(1., 1000.)) ip = pytreesub_top.addNode('ip', 'signal') rec = pytreesub.tdiCompile( "Build_Signal(Build_With_Units(\\MAG_ROGOWSKI.SIGNALS:ROG_FG + 2100. * \\BTOR, 'ampere'), *, DIM_OF(\\BTOR))" ) ip.record = rec ip.tag = 'MAG_PLASMA_CURRENT' ip.tag = 'MAGNETICS_PLASMA_CURRENT' ip.tag = 'MAG_IP' ip.tag = 'MAGNETICS_IP' ip.tag = 'IP' for i in range(10): node = pytreesub_top.addNode('child%02d' % (i, ), 'structure') node.addDevice('dt200_%02d' % (i, ), 'dt200').on = False pytreesub.write()
def test(): pytree = Tree('pytree', self.shot, 'ReadOnly') ip = pytree.getNode('\\ip') self.assertEqual(str(ip), '\\PYTREESUB::IP') self.assertEqual(ip.nid, pytree._IP.nid) self.assertEqual(ip.nid, pytree.__PYTREESUB.IP.nid) self.assertEqual(ip.nid, pytree.__PYTREESUB__IP.nid) self.assertEqual(pytree.TESTDEVICE.__class__, Device.PyDevice('TESTDEVICE')) self.assertEqual(pytree.CYGNET4K.__class__, Device.PyDevice('CYGNET4K'))
def _devHelpDevtype(devtype, full): from pydoc import TextDoc global _device_list if _device_list is None: alldevices=Data.execute('MDSDEVICES()') _device_list=[item[0].strip() for item in alldevices] devnames=[] if ('*' in devtype) or ('?' in devtype): for device in _device_list: if (Data.execute('MdsShr->StrMatchWild(descr($),descr($))',(device.upper(),devtype.upper())) & 1) == 1: devnames.append(DevHelp(device,-1)) return '\n'.join(devnames) else: try: dmod = Device.importPyDeviceModule(devtype) cls = eval('dmod.%s' % dmod.__name__.upper()) if full == 1: return TextDoc().docclass(cls) elif full == -1: return "%s: python device" % devtype else: return cls.__doc__ except: for device in _device_list: if device.upper() == devtype.upper(): return "%s: tdi, java or shared library device" % device return "Error obtaining help on device " + devtype
def MDSDEVICES(): with lock: if cache[0] is None: from MDSplus import Device,tdi,version,getenv from numpy import array def importDevices(name): bname = version.tobytes(name) try: module = __import__(name) ans = [[version.tobytes(k),bname] for k,v in module.__dict__.items() if isinstance(v,int.__class__) and issubclass(v,Device)] except (ImportError, ImportWarning): ans = [] tdidev = tdi("if_error(%s(),*)"%name) if tdidev is None: return ans tdidev = [[k.rstrip(), v.rstrip()] for k,v in tdidev.value.reshape((int(tdidev.value.size/2),2)).tolist()] return tdidev+ans ans = [[version.tobytes(d),b'pydevice'] for d in Device.findPyDevices()] mdsdevs=getenv('MDS_DEVICES') if mdsdevs is not None: modules=mdsdevs.split(':') else: modules=["KbsiDevices","MitDevices","RfxDevices","W7xDevices"] for module in modules: ans += importDevices(module) ans = array(list(dict(ans).items())) ans.view('%s,%s'%(ans.dtype,ans.dtype)).sort(order=['f0'], axis=0) cache[0] = ans return cache[0]
def interface(self): with Tree(self.tree,self.shot,'new') as pytree: Device.PyDevice('TestDevice').Add(pytree,'TESTDEVICE_I') Device.PyDevice('TestDevice').Add(pytree,'TESTDEVICE_S') pytree.write() pytree.normal() self.assertEqual(pytree.TESTDEVICE_S.check_source(),"No source stored in record.") pytree.TESTDEVICE_S._update_source() self.assertEqual(pytree.TESTDEVICE_S.check_source(),"") pytree.close() # needed for windows to release file lock self.assertEqual(dcl('help set verify',1,1,0)[1],None) self.assertEqual(tcl('help set tree',1,1,0)[1],None) self.assertEqual(ccl('help set xandq',1,1,0)[1],None) self.assertEqual(cts('help addcrate',1,1,0)[1],None) """ tcl commands """ self._doTCLTest('type test','test\n') if self.inThread: Tree.usePrivateCtx(1) self._doTCLTest('close/all') self._doTCLTest('show db','\n') self._doTCLTest('set tree pytree/shot=%d'%(self.shot,)) self._doTCLTest('show db','000 PYTREE shot: %d [\\PYTREE::TOP] \n\n'%self.shot) self._doTCLTest('edit PYTREE/shot=%d'%(self.shot,)) self._doTCLTest('add node TCL_NUM/usage=numeric') self._doTCLTest('add node TCL_PY_DEV/model=TESTDEVICE') self._doTCLTest('do TESTDEVICE_I:TASK_TEST') self._doTCLTest('do TESTDEVICE_S:TASK_TEST') self._doTCLTest('do TESTDEVICE_S:ACTIONSERVER:MANUAL') self._doExceptionTest('do TESTDEVICE_I:TASK_ERROR1',Exc.DevUNKOWN_STATE) # w/o timeout self._doExceptionTest('do TESTDEVICE_S:TASK_ERROR1',Exc.DevUNKOWN_STATE) # w/o timeout self._doExceptionTest('do TESTDEVICE_I:TASK_ERROR2',Exc.DevUNKOWN_STATE) # w/ timeout self._doExceptionTest('do TESTDEVICE_S:TASK_ERROR2',Exc.DevUNKOWN_STATE) # w/ timeout self._doExceptionTest('close',Exc.TreeWRITEFIRST) self._doTCLTest('write') self._doTCLTest('close') self._doTCLTest('show db','\n') """ context """ self._doTCLTest('set tree pytree/shot=%d'%(self.shot,)) pytree = Tree() self.assertEqual(str(pytree),'Tree("PYTREE",%d,"Normal")'%self.shot) self._doTCLTest('close pytree/shot=%d'%(self.shot,)) self.assertEqual(str(pytree),'Tree("?",?,"Closed")') if self.inThread: Tree.usePrivateCtx(0) """ tcl exceptions """ self._doExceptionTest('close',Exc.TreeNOT_OPEN) self._doExceptionTest('dispatch/command/server=xXxXxXx type test',Exc.ServerPATH_DOWN) self._doExceptionTest('dispatch/command/server type test',Exc.MdsdclIVVERB)
def do(self): with Tree(self.tree, self.shot, 'new') as tree: Device.PyDevice('TestDevice').Add(tree, 'TESTDEVICE') tree.write() tree.normal() for _ in range(2): self._doTCLTest('do TESTDEVICE:TASK_TEST', tree=tree) self._doExceptionTest('do TESTDEVICE:TASK_ERROR1', Exc.DevUNKOWN_STATE, tree) self._doExceptionTest('do TESTDEVICE:TASK_ERROR2', Exc.DevUNKOWN_STATE, tree) self._doExceptionTest('do TESTDEVICE:TASK_TIMEOUT', Exc.TdiTIMEOUT, tree)
def _devHelpNode(node,full): try: elt=int(node.conglomerate_elt) if elt == 0: return "" if elt == 1: return DevHelp(node.record.model,full) else: devtype=str(TreeNode(node.nid-elt+1,node.tree).record[1]) dmod = Device.importPyDeviceModule(str(devtype)) cls = eval('dmod.%s' % dmod.__name__.upper()) return cls.parts[elt-2]['help'] except Exception: pass return ""
def setUpClass(cls): with cls.lock: if cls.instances == 0: import gc gc.collect() from tempfile import mkdtemp if getenv("TEST_DISTRIBUTED_TREES") is not None: treepath = "localhost::%s" else: treepath = "%s" cls.tmpdir = mkdtemp() cls.root = os.path.dirname(os.path.realpath(__file__)) cls.env = dict((k, str(v)) for k, v in os.environ.items()) cls.envx = {} cls._setenv('PyLib', getenv('PyLib')) cls._setenv("MDS_PYDEVICE_PATH", '%s/devices' % cls.root) cls._setenv("pytree_path", treepath % cls.tmpdir) with Tree('pytree', -1, 'new') as pytree: Device.PyDevice('TestDevice').Add(pytree, 'TESTDEVICE') pytree.write() cls.instances += 1
def DevAddPythonDevice(path, model, nidout=None): """Add a python device to the tree by: 1) finding the model in the list defined by the tdi function, MdsDevices. 2) try importing the package for the model and calling its Add method. Both the path and model are passed in as Ident instances. The StringArray returned by MdsDevices() contains String instances containing blank filled values containing an \0 character embedded. These Strings have to be manipulated to produce simple str() values. """ model = str(model.data()).strip() path = str(path.data()).strip() try: node = Device.PyDevice(model).Add(Tree(), path) if isinstance(nidout, (Ident, )): Data.execute("$=$", nidout, Int32(node.nid)) return TreeNORMAL.status except MDSplusException: return sys.exc_info()[1].status except: print("Error adding device instance of %s: %s" % (model, sys.exc_info()[1])) return MDSplusERROR.status
def nciInfo(self): with Tree('pytree',self.shot+7,'new') as pytree: pytree.addNode('pytreesub','subtree').include_in_pulse=True Device.PyDevice('TestDevice').Add(pytree,'TESTDEVICE') Device.PyDevice('CYGNET4K').Add(pytree,'CYGNET4K').on=False pytree.write() with Tree('pytreesub',self.shot+7,'new') as pytreesub: ip=pytreesub.addNode('ip','signal') ip.record=Signal(Int32(range(10)),None,Range(1.,10.)) ip.tag='MAG_PLASMA_CURRENT' ip.tag='MAGNETICS_PLASMA_CURRENT' ip.tag='MAG_IP' ip.tag='MAGNETICS_IP' ip.tag='IP' ip.setExtendedAttribute('ATT1',100) ip.setExtendedAttribute('ATT2',Range(1,200)) ip.setExtendedAttribute('ATT3','this is ip') ip.setExtendedAttribute('ATT3','this is plasma current') self.assertEqual(str(ip.getExtendedAttribute('ATT1')),'100') self.assertEqual(str(ip.getExtendedAttribute('ATT2')),'1 : 200 : *') self.assertEqual(str(ip.getExtendedAttribute('ATT3')),'this is plasma current') exattr = ip.getExtendedAttributes() self.assertEqual(exattr['ATT1'],100) self.assertEqual(str(exattr['ATT2']),'1 : 200 : *') self.assertEqual(exattr['ATT3'],'this is plasma current') for i in range(3): node=pytreesub.addNode('child%02d' % (i,),'structure') node.addDevice('dt200_%02d' % (i,),'dt200').on=False pytreesub.write() pytree.readonly() self.assertEqual(pytree.TESTDEVICE.__class__,Device.PyDevice('TESTDEVICE')) self.assertEqual(pytree.CYGNET4K.__class__,Device.PyDevice('CYGNET4K')) pytree.CYGNET4K.persistent = {} pytree.CYGNET4K.persistent['a'] = 1 self.assertEqual(pytree.getNode('CYGNET4K').frames.persistent['a'], 1) ip=pytree.getNode('\\ip') self.assertEqual(ip.getUsage(),'SIGNAL') self.assertEqual(ip.usage,ip.getUsage()) try: # do not continue and print when no match self.assertEqual(ip.getClass(),'CLASS_R') except AssertionError: print( "ip.nid=%d" % (ip.nid,)) print( "Error with ip in %s" % (str(ip.tree),)) raise self.assertEqual(ip.class_str,'CLASS_R') self.assertEqual(ip.compressible,False) self.assertEqual(ip.compressible,ip.isCompressible()) self.assertEqual(ip.compress_on_put,True) self.assertEqual(ip.compress_on_put,ip.isCompressOnPut()) self.assertEqual(ip.data_in_nci,False) self.assertEqual(ip.on,True) self.assertEqual(ip.on,ip.isOn()) self.assertEqual(ip.do_not_compress,False) self.assertEqual(ip.do_not_compress,ip.isDoNotCompress()) self.assertEqual(ip.dtype_str,'DTYPE_SIGNAL') self.assertEqual(ip.dtype_str,ip.getDtype()) self.assertEqual(ip.essential,False) self.assertEqual(ip.essential,ip.isEssential()) mhdtree=pytree.getNode('\\PYTREESUB::TOP') self.assertEqual(mhdtree.include_in_pulse,True) self.assertEqual(mhdtree.include_in_pulse,mhdtree.isIncludeInPulse()) self.assertEqual(ip.length,int(Data.execute('getnci($,"LENGTH")',ip))) self.assertEqual(ip.length,ip.getLength()) self.assertEqual(ip.no_write_shot,False) self.assertEqual(ip.no_write_shot,ip.isNoWriteShot()) self.assertEqual(ip.no_write_model,False) self.assertEqual(ip.no_write_model,ip.isNoWriteModel()) self.assertEqual(ip.write_once,False) self.assertEqual(ip.write_once,ip.isWriteOnce()) pydev = pytree.TESTDEVICE part = pydev.conglomerate_nids[1] self.assertEqual(part.PART_NAME(),':ACTIONSERVER') self.assertEqual(part.original_part_name,':ACTIONSERVER') self.assertEqual(str(Data.execute('GETNCI($,"ORIGINAL_PART_NAME")',part)),':ACTIONSERVER') self.assertEqual(pydev.__class__,Device.PyDevice('TestDevice')) devs = pytree.getNodeWild('\\PYTREESUB::TOP.***','DEVICE') part = devs[0].conglomerate_nids[3] self.assertEqual(part.original_part_name,':COMMENT') self.assertEqual(part.original_part_name,str(Data.execute('GETNCI($,"ORIGINAL_PART_NAME")',part))) self.assertEqual(ip.owner_id,ip.getOwnerId()) self.assertEqual(ip.rlength,136) self.assertEqual(ip.rlength,ip.getCompressedLength()) self.assertEqual(ip.setup_information,False) self.assertEqual(ip.setup_information,ip.isSetup()) self.assertEqual(ip.status,0) self.assertEqual(ip.status,ip.getStatus()) self.assertEqual((ip.tags==Array(['IP','MAGNETICS_IP','MAG_IP','MAGNETICS_PLASMA_CURRENT','MAG_PLASMA_CURRENT'])).all(),True) self.assertEqual((ip.tags==ip.getTags()).all(),True) self.assertEqual(ip.time_inserted,ip.getTimeInserted())
def _mimport(filename, names=[], local=locals()): from MDSplus import Device for name in names: Device._mimport(globals(), local, filename, name)
def _mimport(filename, name=None, local=locals()): from MDSplus import Device Device._mimport(globals(), local, filename, name)
def dispatcher(self): shot = self.shot + 1 fmt = { 'EXPT': self.tree.upper(), 'SHOT': shot, } print(self.envx) with Tree(self.tree, shot, 'new') as pytree: Device.PyDevice('TestDevice').Add(pytree, 'TESTDEVICE_I') Device.PyDevice('TestDevice').Add(pytree, 'TESTDEVICE_S', add_source=True) pytree.write() monitor, monitor_port = self._setup_mdsip('ACTION_MONITOR', 'MONITOR_PORT', 7100 + self.index, False) monitor_opt = "/monitor=%s" % monitor if monitor else "" server, server_port = self._setup_mdsip('ACTION_SERVER', 'ACTION_PORT', 7110 + self.index, True) pytree.normal() pytree.TESTDEVICE_I.ACTIONSERVER.no_write_shot = False pytree.TESTDEVICE_I.ACTIONSERVER.record = server pytree.TESTDEVICE_S.ACTIONSERVER.no_write_shot = False pytree.TESTDEVICE_S.ACTIONSERVER.record = server """ using dispatcher """ mon, mon_log, svr, svr_log = (None, None, None, None) try: mon, mon_log = self._start_mdsip(monitor, monitor_port, 'monitor', 'TCP') svr, svr_log = self._start_mdsip(server, server_port, 'action', 'TCP') """ tcl dispatch """ self._testDispatchCommand(server, 'type test') env = "%s_path" % self.tree self._doTCLTest('env ' + env, '%s=%s\n' % (env, self.envx[env])) self._doTCLTest('set tree %(EXPT)s/shot=%(SHOT)d' % fmt) self._doTCLTest('dispatch/build%s' % monitor_opt) self._doTCLTest('dispatch/phase%s INIT' % monitor_opt) self._waitIdle(server, 3) self._doTCLTest('dispatch/phase%s PULSE' % monitor_opt) self._waitIdle(server, 3) self._doTCLTest('dispatch/phase%s STORE' % monitor_opt) self._waitIdle(server, 3) """ tcl exceptions """ self._doExceptionTest('dispatch/command/server=%s ' % server, Exc.MdsdclIVVERB) """ tcl check if still alive """ if mon: self.assertEqual(mon.poll(), None) if svr: self.assertEqual(svr.poll(), None) finally: if svr_log: svr_log.close() if mon_log: mon_log.close() self._stop_mdsip((svr, server), (mon, monitor)) self._doTCLTest('close/all') pytree.readonly() self.assertTrue(pytree.TESTDEVICE_I.INIT1_DONE.record <= pytree.TESTDEVICE_I.INIT2_DONE.record) self.assertTrue(pytree.TESTDEVICE_S.INIT1_DONE.record <= pytree.TESTDEVICE_S.INIT2_DONE.record) self.assertTrue(pytree.TESTDEVICE_I.INIT2_DONE.record <= pytree.TESTDEVICE_I.STORE_DONE.record) self.assertTrue(pytree.TESTDEVICE_S.INIT2_DONE.record <= pytree.TESTDEVICE_S.STORE_DONE.record) self.assertEqual(pytree.TESTDEVICE_I.CHANNEL.data().tolist(), [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) self.assertEqual(pytree.TESTDEVICE_S.CHANNEL.data().tolist(), [0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
def test(): pytree = Tree('pytree', self.shot, 'ReadOnly') ip = pytree.getNode('\\ip') self.assertEqual(ip.getUsage(), 'SIGNAL') self.assertEqual(ip.usage, ip.getUsage()) try: # do not continue and print when no match self.assertEqual(ip.getClass(), 'CLASS_R') except AssertionError: print("ip.nid=%d" % (ip.nid, )) print("Error with ip in %s" % (str(ip.tree), )) raise self.assertEqual(ip.class_str, 'CLASS_R') self.assertEqual(ip.compressible, False) self.assertEqual(ip.compressible, ip.isCompressible()) self.assertEqual(ip.compress_on_put, True) self.assertEqual(ip.compress_on_put, ip.isCompressOnPut()) self.assertEqual(ip.data_in_nci, False) self.assertEqual(ip.on, True) self.assertEqual(ip.on, ip.isOn()) self.assertEqual(ip.do_not_compress, False) self.assertEqual(ip.do_not_compress, ip.isDoNotCompress()) self.assertEqual(ip.dtype_str, 'DTYPE_SIGNAL') self.assertEqual(ip.dtype_str, ip.getDtype()) self.assertEqual(ip.essential, False) self.assertEqual(ip.essential, ip.isEssential()) mhdtree = pytree.getNode('\\PYTREESUB::TOP') self.assertEqual(mhdtree.include_in_pulse, True) self.assertEqual(mhdtree.include_in_pulse, mhdtree.isIncludeInPulse()) self.assertEqual(ip.length, int(Data.execute('getnci($,"LENGTH")', ip))) self.assertEqual(ip.length, ip.getLength()) self.assertEqual(ip.no_write_shot, False) self.assertEqual(ip.no_write_shot, ip.isNoWriteShot()) self.assertEqual(ip.no_write_model, False) self.assertEqual(ip.no_write_model, ip.isNoWriteModel()) self.assertEqual(ip.write_once, False) self.assertEqual(ip.write_once, ip.isWriteOnce()) pydev = pytree.TESTDEVICE part = pydev.conglomerate_nids[1] self.assertEqual(part.PART_NAME(), ':ACTIONSERVER') self.assertEqual(part.original_part_name, ':ACTIONSERVER') self.assertEqual( str(Data.execute('GETNCI($,"ORIGINAL_PART_NAME")', part)), ':ACTIONSERVER') self.assertEqual(pydev.__class__, Device.PyDevice('TestDevice')) devs = pytree.getNodeWild('\\PYTREESUB::TOP.***', 'DEVICE') part = devs[0].conglomerate_nids[3] self.assertEqual(part.original_part_name, ':COMMENT') self.assertEqual( part.original_part_name, str(Data.execute('GETNCI($,"ORIGINAL_PART_NAME")', part))) self.assertEqual(ip.owner_id, ip.getOwnerId()) self.assertEqual(ip.rlength, 168) self.assertEqual(ip.rlength, ip.getCompressedLength()) self.assertEqual(ip.setup_information, False) self.assertEqual(ip.setup_information, ip.isSetup()) self.assertEqual(ip.status, 0) self.assertEqual(ip.status, ip.getStatus()) self.assertEqual((ip.tags == makeArray([ 'IP', 'MAGNETICS_IP', 'MAG_IP', 'MAGNETICS_PLASMA_CURRENT', 'MAG_PLASMA_CURRENT' ])).all(), True) self.assertEqual((ip.tags == ip.getTags()).all(), True) self.assertEqual(ip.time_inserted, ip.getTimeInserted())