Merge lp:~adeuring/launchpad/bug-688130 into lp:launchpad
Status: | Merged |
---|---|
Approved by: | Abel Deuring |
Approved revision: | no longer in the source branch. |
Merged at revision: | 12469 |
Proposed branch: | lp:~adeuring/launchpad/bug-688130 |
Merge into: | lp:launchpad |
Diff against target: |
329 lines (+166/-14) 5 files modified
lib/lp/testing/factory.py (+18/-0) lib/lp/translations/model/pofile.py (+12/-5) lib/lp/translations/tests/test_pofile.py (+128/-0) lib/lp/translations/tests/test_potmsgset.py (+7/-0) lib/lp/translations/utilities/rosettastats.py (+1/-9) |
To merge this branch: | bzr merge lp:~adeuring/launchpad/bug-688130 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gavin Panella (community) | Approve | ||
Review via email: mp+51107@code.launchpad.net |
Commit message
[r=allenap][bug=688130,720199] ensure that factory.
Description of the change
This branch fixes bug 688130: "Statistics clean-ups and extra tests".
Many translation statistics are calculated in POFile.
These methods did not treat empty translations properly and translations which are only partially translated, i.e. those which required singlar and plural variants.
Jeroen recently fixed the case for empty translations, leaving only the partial translations: If a message is not completely translated, we want to count it as untranslated.
The SQL query in _countTranslati
_countSuggestions() included translations which are diverged for another target than the POFile/POTemplate for which _countSuggestions() was called; this is fixed too.
As a drive-by fix, I added an "assert" to factory.
As another drive-by fix I removed a silly attempt to round a floating point number to two decimal digits from RosettaStats.
test: ./bin/test -vvt test_pofile
no lint
Looks good to me.
[1]
+ tti_for_ message_ in_template = TranslationTemp lateItem. selectOneBy( potmsgset, potemplate= pofile. potemplate)
+ potmsgset=
I think we should try to avoid the SQLObject shim. How about:
IStore( TranslationTemp lateItem) .find(
TranslationTem plateItem. potmsgset == potmsgset,
TranslationTem plateItem. potemplate == pofile. potemplate) .one()
[2]
+ def test_POFile_ updateStatistic s_diverged_ message_ this_side( self): updateStatistic s_diverged_ message_ other_side( self):
+ # Translations that are diverged for a given target do not
+ # appear in the statistical data for another target.
...
+ def test_POFile_
+ # Translations that are diverged for a given target do not
+ # appear in the statistical data for another target.
These have the same explanation. Is there a difference?
[3]
I can't pretend to know enough about Translations to be able to do a
really thorough review of this, so if you feel less than confident
about this branch perhaps you should ask a domain expert to go over it
too.