+
+ def test7(self):
+ """EDF17963 : Python3 porting. Py3 Pickeling generates more often byte(0) into the bytes. This reveals an incorrect management of Python Bytes -> Any String that leads to truncated bytes."""
+
+ entree_script="""Study = "toto"
+print("Entree", Study)"""
+
+ pyscript0_script="""entier = 42
+print("PyScript0",entier)
+"""
+
+ sortie_script="""import numpy as np
+assert(isinstance(resultats,np.ndarray))
+assert(resultats==np.array(range(1),dtype=np.int32))
+"""
+
+ nbWorkers=1
+
+ SALOMERuntime.RuntimeSALOME.setRuntime()
+ r=SALOMERuntime.getSALOMERuntime()
+ #
+ p0=r.createProc("run")
+ #
+ td=p0.createType("double","double")
+ ti=p0.createType("int","int")
+ ts=p0.createType("string","string")
+ tp=p0.createInterfaceTc("python:obj:1.0","pyobj",[])
+ tdd=p0.createSequenceTc("seqdouble","seqdouble",td)
+ tds=p0.createSequenceTc("seqstr","seqstr",ts)
+ tdp=p0.createSequenceTc("list[pyobj]","list[pyobj]",tp)
+ #
+ n0 = r.createScriptNode("Salome","Entree")
+ n0.setExecutionMode("local")
+ n0.setScript(entree_script)
+ o0 = n0.edAddOutputPort("Study",tp)
+ p0.edAddChild(n0)
+ #
+ n1 = r.createOptimizerLoop("MainLoop","async_plugin.py","myalgosync",True)
+ n1.edGetNbOfBranchesPort().edInitInt(nbWorkers)
+ p0.edAddChild(n1)
+ #
+ n10=r.createScriptNode("Salome","PyScript0")
+ n10.setScript(pyscript0_script)
+ i1 = n10.edAddInputPort("double",td)
+ o1 = n10.edAddOutputPort("entier",ti)
+ n10.setExecutionMode("local")
+ n1.edAddChild(n10)
+ #
+ n2 = r.createScriptNode("Salome","Sortie")
+ n2.setExecutionMode("local")
+ n2.setScript(sortie_script)
+ i2 = n2.edAddInputPort("resultats",tp)
+ p0.edAddChild(n2)
+ #
+ p0.edAddCFLink(n0,n1)
+ p0.edAddCFLink(n1,n2)
+ #
+ p0.edAddLink(o0,n1.getInputPort("algoInit"))
+ p0.edAddLink(n1.getOutputPort("algoResults"),i2)
+ p0.edAddLink(n1.getOutputPort("evalSamples"),i1)
+ p0.edAddLink(o1,n1.getInputPort("evalResults"))
+ #
+ #p0.saveSchema(fname)
+ #
+ ex=pilot.ExecutorSwig()
+ ex.RunW(p0,0)
+ self.assertTrue(p0.getEffectiveState() == pilot.DONE)
+ pass