Grammalecte  Check-in [e39cca00d3]

Overview
Comment:[fr] fix tests.py
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | fr
Files: files | file ages | folders
SHA3-256: e39cca00d34e3ad4a3c9c1d198313cf43cf5cafda6d95bc2577beb2fca658558
User & Date: olr on 2019-07-22 11:47:09
Other Links: manifest | tags
Context
2019-07-22
20:00
[core][fr] morphVC() update check-in: 02901ad6ae user: olr tags: trunk, fr, core
11:47
[fr] fix tests.py check-in: e39cca00d3 user: olr tags: trunk, fr
06:55
[core] listRules() check-in: 00c946ab84 user: olr tags: trunk, core
Changes

Modified gc_lang/fr/modules/tests.py from [4d8492a2e0] to [3d6c560ee1].

202
203
204
205
206
207
208
209
210


211
212
213
214
215
216
217
202
203
204
205
206
207
208


209
210
211
212
213
214
215
216
217







-
-
+
+







                              "\n  found:    " + sFoundSuggs + \
                              "\n  errors:   \n" + sListErr)
                        nError += 1
            if nError:
                print("Unexpected errors:", nError)
        # untested rules
        i = 0
        for sOpt, sLineId, sRuleId in gce.listRules():
            if sOpt != "@@@@" and sLineId not in self._aTestedRules and not re.search("^[0-9]+[sp]$|^[pd]_", sRuleId):
        for _, sOpt, sLineId, sRuleId in gce.listRules():
            if sOpt != "@@@@" and sRuleId not in self._aTestedRules and not re.search("^[0-9]+[sp]$|^[pd]_", sRuleId):
                echo(sLineId + "/" + sRuleId, end= ", ")
                i += 1
        if i:
            echo("\n[{} untested rules]".format(i))

    def _splitTestLine (self, sLine):
        sText, sSugg = sLine.split("->>")
227
228
229
230
231
232
233
234

235
236
237
238
239
240
241
227
228
229
230
231
232
233

234
235
236
237
238
239
240
241







-
+







        sRes = " " * len(sLine)
        sListErr = ""
        lAllSugg = []
        for dErr in aErrs:
            sRes = sRes[:dErr["nStart"]] + "~" * (dErr["nEnd"] - dErr["nStart"]) + sRes[dErr["nEnd"]:]
            sListErr += "    * {sLineId} / {sRuleId}  at  {nStart}:{nEnd}\n".format(**dErr)
            lAllSugg.append("|".join(dErr["aSuggestions"]))
            self._aTestedRules.add(dErr["sLineId"])
            self._aTestedRules.add(dErr["sRuleId"])
            # test messages
            if "<start>" in dErr["sMessage"] or "<end>" in dErr["sMessage"]:
                print("\n# Line num : " + dErr["sLineId"] + \
                      "\n  rule name: " + dErr["sRuleId"] + \
                      "\n  message  : " + dErr["sMessage"])
        return sRes, sListErr, "|||".join(lAllSugg)