Open tognee opened 2 weeks ago
:warning: Please install the to ensure uploads and comments are reliably processed by Codecov.
Attention: Patch coverage is 0%
with 2 lines
in your changes missing coverage. Please review.
Project coverage is 93.02%. Comparing base (
f465821
) to head (5aa3c86
).
Files with missing lines | Patch % | Lines |
---|---|---|
wagtail_localize/views/edit_translation.py | 0.00% | 1 Missing and 1 partial :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Any chance you could add a test or two?
To add tests I would need to add a machine translator that could fail. Can I edit the dummy translator so that it doesn't generate a response if the text to translate is more than 50 words, or should I add another machine translator just for the test?
You could mock patch https://github.com/wagtail/wagtail-localize/blob/main/wagtail_localize/machine_translators/dummy.py#L23 for your test only
For my first implementation I would need to patch the translate method in the DummyTranslator class. I've extended the implementation to check if the StringValue data is null.
Added tests for both of them and it seems to be working.
Currently there is no way to keep a field not translated in case of issues with the machine translator. Setting the value to an empty StringValue will show the field as translated in the admin.
This patch will let machine translators omit the key value pair to keep the field not translated.
(Sorry for the double PR, had issues with my linter)