6 from Editeur import appli
8 def add_param(j,pos,nom,valeur):
9 co=j.addentite("PARAMETRE",pos)
14 def add_mcsimp(obj,nom,valeur):
15 mcs=obj.get_child(nom,restreint='oui')
17 pos=obj.get_index_child(nom)
18 mcs=obj.addentite(nom,pos)
19 mcs.set_valeur(mcs.eval_val(valeur))
22 def cdiff(text1,text2):
23 return " ".join(difflib.context_diff(text1.splitlines(1),text2.splitlines(1)))
25 class TestCase(unittest.TestCase):
29 self.app=appli.STANDALONE(version='v9')
33 CONTEXT.unset_current_step()
36 files= os.path.join(os.path.dirname(__file__),"*.comm")
37 for f in glob.glob(os.path.join(prefs.INSTALLDIR,files)):
38 for o in ('3','2','1','0','m'):
40 if os.path.isfile(f):break
43 exec """def test%s(self,file="%s"):
49 def commtest(self,file):
52 name=os.path.splitext(os.path.basename(file))[0]
53 errfile=os.path.join(os.path.dirname(__file__),name+".err")
55 if os.path.isfile(errfile):
59 j=self.app.openJDC(file=file)
60 assert j.cr.get_mess_exception() == ""
63 assert j.isvalid(),j.report()
66 assert txt == err,cdiff(err,txt)
68 CONTEXT.unset_current_step()
70 assert sys.getrefcount(j) == 2,sys.getrefcount(j)