def test_prefetch_translations_parameters(self):
        article = self.articles[0]

        #
        # prefetch_translations(field_names=['title'])
        #

        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), '')

        #
        # prefetch_translations(populate_missing=True)
        #

        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' % language)

        with self.assertNumQueries(2):
            for language in ('fr', 'en'):
                self.assertNotEqual(getattr(article, 'content_%s' % language), '')

        #
        # prefetch_translations(languages=['en'])
        #

        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)

        #
        # Be sure prefetch_translations(languages='en') is interpreted as
        # prefetch_translations(languages=['en'])
        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/operator `%` -> `*`