Exemplo n.º 1
0
    def test_inherited_translation(self):
        class InheritedTranslation(Translation):

            def translate(self):
                return self.text + 'something'

        message = Translation()
        message.init('text {0} {two}', 'one', two='two')

        casted = InheritedTranslation(message)
        assert casted() == 'text one twosomething'
Exemplo n.º 2
0
    def test_casting(self):
        class InheritedTranslation(Translation):
            pass

        message = Translation()
        message.init('text', 'one', two='two')

        casted = InheritedTranslation(message)

        assert casted.text == 'text'
        assert casted.args == ('one',)
        assert casted.kwargs == {'two': 'two'}
Exemplo n.º 3
0
    def test_normaln_translating(self):
        message = Translation()
        message.init('text {0} {two}', 'one', two='two')

        assert message() == 'text one two'