But that is just how I would do that. Makes test failures easier to spot.
Also, unrelated parts of a test will not be run if one fails. Maybe that
second reasoning is even stronger.
> +
> +
> class TestTranslationMessageFindIdenticalMessage(TestCaseWithFactory):
> """Tests for `TranslationMessage.findIdenticalMessage`."""
>
Here one comment, I forgot.
> === modified file 'lib/lp/ translations/ tests/test_ translationmess age.py' translations/ tests/test_ translationmess age.py 2009-08-25 20:15:38 +0000 translations/ tests/test_ translationmess age.py 2010-06-19 03:38:37 +0000 sage`." "" launchpad. webapp. testing import verifyObject worlddata. interfaces. language import ILanguageSet .model. potranslation import POTranslation .model. translationmess age import DummyTranslatio nMessage .interfaces. translationmess age import ( sage) .interfaces. translations import TranslationCons tants eLayer Message( TestCaseWithFac tory): sage`.
> --- lib/lp/
> +++ lib/lp/
> @@ -1,4 +1,4 @@
> -# Copyright 2009 Canonical Ltd. This software is licensed under the
> +# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
> # GNU Affero General Public License version 3 (see the file LICENSE).
>
> """Unit tests for `TranslationMes
> @@ -10,12 +10,46 @@
> from zope.component import getUtility
> from zope.security.proxy import removeSecurityProxy
>
> +from canonical.
> from lp.services.
> from lp.testing import TestCaseWithFactory
> from lp.translations
> +from lp.translations
> +from lp.translations
> + ITranslationMes
> from lp.translations
> from canonical.testing import ZopelessDatabas
>
> +
> +class TestTranslation
> + """Unit tests for `TranslationMes
> +
> + There aren't many of these. We didn't do much unit testing back
> + then.
> + """
And thanks a lot for adding these! ;-)
> + eLayer self): makeTranslation Message( ) ITranslationMes sage, message)
> + layer = ZopelessDatabas
> +
> + def test_baseline(
> + message = self.factory.
> + verifyObject(
I'd have split this test here.
> + makePOFile( 'nl') makePOTMsgSet( pofile. potemplate) nMessage( pofile, potmsgset) ITranslationMes sage, dummy) diverged( self): sage.is_ diverged is a little helper to let you is_diverged" which can be clearer than makeTranslation Message( force_diverged= False) e(message. is_diverged)
> + pofile = self.factory.
> + potmsgset = self.factory.
> + dummy = DummyTranslatio
> + verifyObject(
> +
> + def test_is_
> + # ITranslationMes
> + # say "message.
> + # "message.potemplate is not None."
> + message = self.factory.
> + self.assertFals
> +
And this one here.
> + message = self.factory. makeTranslation Message( force_diverged= True) (message. is_diverged)
> + self.assertTrue
But that is just how I would do that. Makes test failures easier to spot.
Also, unrelated parts of a test will not be run if one fails. Maybe that
second reasoning is even stronger.
> + MessageFindIden ticalMessage( TestCaseWithFac tory): sage.findIdenti calMessage` ."""
> +
> class TestTranslation
> """Tests for `TranslationMes
>
Cheers, Henning