Repository navigation
Update languages.py - #5341
Merged
Merged
Update languages.py#5341
Conversation
Fix bug on BDD prefix matching failure and add some Gherkin prefix for french localization
pekkaklarck
approved these changes
Feb 27, 2025
pekkaklarck
left a comment
Member
There was a problem hiding this comment.
Looks very good. Changes aren't exactly related, so it would be better to have separate PRs. Because changes are so simple, splitting the PR now doesn't have any real benefits, though.
See the inline comments for few other notes. I can fix those issues myself as well if needed.
| then_prefixes = ['Alors'] | ||
| and_prefixes = ['Et'] | ||
| but_prefixes = ['Mais'] | ||
| given_prefixes = ['Étant donné', 'Étant donné que', "Étant donné qu'", 'Soit', 'Sachant que', "Sachant qu'", 'Sachant', 'Etant donné', 'Etant donné que', "Etant donné qu'", 'Etant donnée', 'Etant données'] |
Member
There was a problem hiding this comment.
Please split this to max 88 chars.
| self._bdd_prefix_regexp = re.compile(rf'({prefixes})\s', re.IGNORECASE) | ||
| prefixes = sorted(self.bdd_prefixes, key=len, reverse=True) | ||
| pattern = '|'.join(prefix.replace(' ', r'\s') for prefix in prefixes).lower() | ||
| self._bdd_prefix_regexp = re.compile(rf'({pattern})\s', re.IGNORECASE) |
Member
There was a problem hiding this comment.
It would be good to add a unit test for this fix in utest/api/test_languages.py .
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix bug on BDD prefix matching failure and add some Gherkin prefix for french localization.
Fixes #5150 (add French Gherkin Localization)
Fixes #5340 (fix bug on bdd prefix matching)