1 # -*- coding: iso-8859-1 -*-
7 class TestJDCCase(unittest.TestCase):
11 # OP2 : CO converti en concept2 ou concept2. Retourne concept
12 # OP6 : uniquement CO converti en concept2. Retourne concept
13 # OP3 : CO converti en concept ou concept. Retourne concept
14 co0=OP2(MATR=CO("x1"))
15 co2=OP6(MATR=CO("xx"))
16 co3=OP3(MATR={"CHAM":"R","MM":co2})
18 self.execute(cata5,text)
22 # OP2 : CO converti en concept2 ou concept2. Retourne concept
23 # OP5 : uniquement CO converti en concept2. Retourne concept
24 co0=OP2(MATR=CO("x1"))
27 expected="""DEBUT CR validation : bidon
28 Etape : OP5 ligne : 5 fichier : 'bidon'
30 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
31 ! concept co0 de type concept (de type <class 'cata5.concept'>) n'est pas d'un !
32 ! type autorisé: (<class 'Accas.A_ASSD.CO'>,) !
33 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
34 Fin Mot-clé simple : MATR
36 FIN CR validation :bidon
38 self.execute(cata5,text,err3=expected)
42 # OP2 : CO converti en concept2 ou concept2. Retourne concept
43 co0=OP2(MATR=CO("x1"))
47 expected="""DEBUT CR validation : bidon
48 Etape : OP2 ligne : 5 fichier : 'bidon'
50 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
51 ! concept co0 de type concept (de type <class 'cata5.concept'>) n'est pas d'un !
52 ! type autorisé: (<class 'Accas.A_ASSD.CO'>, <class 'cata5.concept2'>) !
53 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
54 Fin Mot-clé simple : MATR
56 FIN CR validation :bidon
58 self.execute(cata5,text,err3=expected)
62 co2=OP14(MATR=CO("xx"))
65 self.execute(cata5,text,err4=expected)
69 co2=OP18(MATR=CO("xx"))
74 self.execute(cata5,text,err4=expected)
78 co2=OP10(MATR=CO("xx"))
80 expected="""DEBUT CR validation : bidon
81 Etape : OP10 ligne : 2 fichier : 'bidon'
83 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
84 ! concept xx de type CO (de type <class 'Accas.A_ASSD.CO'>) n'est pas d'un type !
85 ! autorisé: (<class 'cata5.concept2'>,) !
86 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
87 Fin Mot-clé simple : MATR
89 FIN CR validation :bidon
91 self.execute(cata5,text,err3=expected)
95 co=OP22(MATR=CO("xx"))
97 self.execute(cata5,text)
101 co=OP22(MATR=CO("xx"))
104 expected="""DEBUT CR validation : bidon
105 Etape : OP22 ligne : 3 fichier : 'bidon'
106 Mot-clé simple : MATR
107 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
108 ! concept xx de type concept4 (de type <class 'cata5.concept4'>) n'est pas d'un !
109 ! type autorisé: (<class 'Accas.A_ASSD.CO'>,) !
110 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
111 Fin Mot-clé simple : MATR
113 FIN CR validation :bidon
115 self.execute(cata5,text,err3=expected)
123 def execute(self,cata,text_jdc,err1="",err2="",err3="",err4=""):
124 j=cata.JdC(procedure=text_jdc,cata=cata,nom="bidon")
128 # On compile le texte Python
130 # On initialise les tops de mesure globale de temps d'execution du jdc
131 j.cpu_user=os.times()[0]
132 j.cpu_syst=os.times()[1]
137 self.assert_(j.cr.estvide(),msg='Erreur non attendue dans compile (err1):\n%s' % str(j.cr))
139 self.assert_(self.check(err1,str(j.cr)),msg='Erreur non attendue dans compile (err1):\n%s\n!=\n%s' % (str(j.cr),err1))
146 self.assert_(j.cr.estvide(),msg='Erreur non attendue dans exec_compile (err2):\n%s' % str(j.cr))
148 self.assert_(self.check(err2,str(j.cr)),msg='Erreur non attendue dans exec_compile(err2):\n%s\n!=\n%s' % (str(j.cr),err2))
155 self.assert_(cr.estvide(),msg='Erreur non attendue dans exec_compile (err3):\n%s' % str(cr))
157 self.assert_(self.check(err3,str(cr)),msg='Erreur non attendue dans exec_compile(err3):\n%s\n!=\n%s' % (str(cr),err3))
165 def check(self,want,got):
166 return compare.check(want,got)