Overview
Comment: | [core] tests: test suggestions without order |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | core |
Files: | files | file ages | folders |
SHA3-256: |
2f0c89c8850517fd3ce627713ffe3955 |
User & Date: | olr on 2021-01-02 17:25:46 |
Other Links: | manifest | tags |
Context
2021-01-02
| ||
22:51 | [fr] ajustements et nouvelles règles check-in: c642359726 user: olr tags: fr, trunk | |
17:25 | [core] tests: test suggestions without order check-in: 2f0c89c885 user: olr tags: core, trunk | |
2020-12-31
| ||
09:46 | [server] fix header for Linux check-in: 10b0ef82fa user: olr tags: server, trunk | |
Changes
Modified gc_core/py/lang_core/tests_core.py from [732f98b704] to [35ff717ad9].
︙ | ︙ | |||
101 102 103 104 105 106 107 | print("\n# Line num: " + sLineNum + \ "\n> to check: " + _fuckBackslashUTF8(sTextToCheck) + \ "\n expected: " + sExpectedErrors + \ "\n found: " + sFoundErrors + \ "\n errors: \n" + sListErr) nUnexpectedErrors += 1 elif sExceptedSuggs: | | | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | print("\n# Line num: " + sLineNum + \ "\n> to check: " + _fuckBackslashUTF8(sTextToCheck) + \ "\n expected: " + sExpectedErrors + \ "\n found: " + sFoundErrors + \ "\n errors: \n" + sListErr) nUnexpectedErrors += 1 elif sExceptedSuggs: if not self._checkSuggestions(sExceptedSuggs, sFoundSuggs): print("\n# Line num: " + sLineNum + \ "\n> to check: " + _fuckBackslashUTF8(sTextToCheck) + \ "\n expected: " + sExceptedSuggs + \ "\n found: " + sFoundSuggs + \ "\n errors: \n" + sListErr) nUnexpectedErrors += 1 print("Tests with expected errors:", nTestWithExpectedError, " and suggestions:", nTestWithExpectedErrorAndSugg, ":{:.4}%".format(nTestWithExpectedErrorAndSugg/nTestWithExpectedError*100)) |
︙ | ︙ | |||
164 165 166 167 168 169 170 171 172 173 174 175 176 177 | def _getExpectedErrors (self, sLine): sRes = " " * len(sLine) for i, m in enumerate(self._zError.finditer(sLine)): nStart = m.start() - (4 * i) nEnd = m.end() - (4 * (i+1)) sRes = sRes[:nStart] + "~" * (nEnd - nStart) + sRes[nEnd:-4] return sRes def purgeMessage (sMessage): for sToReplace, sReplacement in [ ("l’ ", "l’"), ("d’ ", "d’"), ("n’ ", "n’"), ("j’ ", "j’"), ("m’ ", "m’"), ("t’ ", "t’"), ("s’ ", "s’"), ("qu’ ", "qu’"), ("L’ ", "L’"), ("D’ ", "D’"), ("N’ ", "N’"), ("J’ ", "J’"), ("M’ ", "M’"), ("T’ ", "T’"), ("S’ ", "S’"), ("QU’ ", "QU’") ]: | > > > > > > > > > > | 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | def _getExpectedErrors (self, sLine): sRes = " " * len(sLine) for i, m in enumerate(self._zError.finditer(sLine)): nStart = m.start() - (4 * i) nEnd = m.end() - (4 * (i+1)) sRes = sRes[:nStart] + "~" * (nEnd - nStart) + sRes[nEnd:-4] return sRes def _checkSuggestions (self, sExceptedSuggs, sFoundSuggs): lAllExpectedSuggs = sExceptedSuggs.split("|||") lAllFoundSuggs = sFoundSuggs.split("|||") if len(lAllExpectedSuggs) != len(lAllFoundSuggs): return False for sExceptedSuggs, sFoundSuggs in zip(lAllExpectedSuggs, lAllFoundSuggs): if set(sExceptedSuggs.split("|")) != set(sFoundSuggs.split("|")): return False return True def purgeMessage (sMessage): for sToReplace, sReplacement in [ ("l’ ", "l’"), ("d’ ", "d’"), ("n’ ", "n’"), ("j’ ", "j’"), ("m’ ", "m’"), ("t’ ", "t’"), ("s’ ", "s’"), ("qu’ ", "qu’"), ("L’ ", "L’"), ("D’ ", "D’"), ("N’ ", "N’"), ("J’ ", "J’"), ("M’ ", "M’"), ("T’ ", "T’"), ("S’ ", "S’"), ("QU’ ", "QU’") ]: |
︙ | ︙ |