当前位置: 首页>>代码示例>>Python>>正文


Python models.Translation类代码示例

本文整理汇总了Python中mkt.translations.models.Translation的典型用法代码示例。如果您正苦于以下问题:Python Translation类的具体用法?Python Translation怎么用?Python Translation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Translation类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_translation_sequence_increases

 def test_translation_sequence_increases(self):
     """Make sure translation sequence increases monotonically."""
     newtrans1 = Translation.new('abc', 'en-us')
     newtrans1.save()
     newtrans2 = Translation.new('def', 'de')
     newtrans2.save()
     assert newtrans2.pk > newtrans1.pk, (
         'Translation sequence needs to keep increasing.')
开发者ID:rachelhathaway,项目名称:zamboni,代码行数:8,代码来源:test_models.py

示例2: test_cache_key

def test_cache_key():
    # Test that we are not taking the db into account when building our
    # cache keys for django-cache-machine. See bug 928881.
    eq_(Translation._cache_key(1, 'default'),
        Translation._cache_key(1, 'slave'))

    # Test that we are using the same cache no matter what Translation class
    # we use.
    eq_(PurifiedTranslation._cache_key(1, 'default'),
        Translation._cache_key(1, 'default'))
    eq_(LinkifiedTranslation._cache_key(1, 'default'),
        Translation._cache_key(1, 'default'))
开发者ID:rachelhathaway,项目名称:zamboni,代码行数:12,代码来源:test_models.py

示例3: test_empty_translations_seq

 def test_empty_translations_seq(self):
     """Make sure we can handle an empty translation sequence table."""
     TranslationSequence.objects.all().delete()
     newtrans = Translation.new('abc', 'en-us')
     newtrans.save()
     assert newtrans.id > 0, (
         'Empty translation table should still generate an ID.')
开发者ID:rachelhathaway,项目名称:zamboni,代码行数:7,代码来源:test_models.py

示例4: test_single_translation_sequence

 def test_single_translation_sequence(self):
     """Make sure we only ever have one translation sequence."""
     TranslationSequence.objects.all().delete()
     eq_(TranslationSequence.objects.count(), 0)
     for i in range(5):
         newtrans = Translation.new(str(i), 'en-us')
         newtrans.save()
         eq_(TranslationSequence.objects.count(), 1)
开发者ID:rachelhathaway,项目名称:zamboni,代码行数:8,代码来源:test_models.py

示例5: test_whitespace

 def test_whitespace(self):
     t = Translation(localized_string='     khaaaaaan!    ', id=999)
     t.save()
     eq_('khaaaaaan!', t.localized_string)
开发者ID:rachelhathaway,项目名称:zamboni,代码行数:4,代码来源:test_models.py

示例6: test_sorting

 def test_sorting(self):
     """Test translation comparisons in Python code."""
     b = Translation.new('bbbb', 'de')
     a = Translation.new('aaaa', 'de')
     c = Translation.new('cccc', 'de')
     eq_(sorted([c, a, b]), [a, b, c])
开发者ID:rachelhathaway,项目名称:zamboni,代码行数:6,代码来源:test_models.py


注:本文中的mkt.translations.models.Translation类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。