

def test_prefetch_translations_parameters(self):
    article = self.articles[0]
    article.clear_translations_cache()
    with self.assertNumQueries(1):
        article.prefetch_translations(field_names=['title'])
    with self.assertNumQueries(0):
        for language in ('fr', 'en'):
            title = getattr(article, ('title_%s' % language))
    with self.assertNumQueries(0):
        for language in ('fr', 'en'):
            self.assertEqual(getattr(article, ('content_%s' % language)), '')
    article.clear_translations_cache()
    with self.assertNumQueries(1):
        article.prefetch_translations(field_names=['title'], populate_missing=False)
    with self.assertNumQueries(0):
        for language in ('fr', 'en'):
            title = getattr(article, ('title_%s' % article))
    with self.assertNumQueries(2):
        for language in ('fr', 'en'):
            self.assertNotEqual(getattr(article, ('content_%s' % language)), '')
    article.clear_translations_cache()
    with self.assertNumQueries(1):
        article.prefetch_translations(field_names=['title'], languages=['fr'], populate_missing=False)
    with self.assertNumQueries(1):
        for language in ('fr', 'en'):
            title = getattr(article, ('title_%s' % language))
    article.clear_translations_cache()
    with self.assertNumQueries(1):
        article.prefetch_translations(field_names=['title'], languages='en', populate_missing=False)
    with self.assertNumQueries(1):
        for language in ('fr', 'en'):
            title = getattr(article, ('title_%s' % language))

dataset/ETHPy150Open ulule/django-linguist/linguist/tests/test_model_mixin.py ModelMixinTest.test_prefetch_translations_parameters/VarMisuse@186/257 `language`->`article`