

def test_select_related_from_translated_field(self):
    with translation.override('en'):
        Related.objects.language().create(pk=1, translated=self.normal1).save()
        with r.assertNumQueries(1):
            r = Related.objects.language().select_related('translated').get(translated=self.normal1)
            self.assertEqual(r.translated.pk, self.normal_id[1])
            self.assertEqual(self.normal1.shared_field, r.translated.shared_field)
            self.assertEqual(self.normal1.translated_field, r.translated.translated_field)

dataset/ETHPy150Open KristianOellegaard/django-hvad/hvad/tests/related.py SelectRelatedTests.test_select_related_from_translated_field/VarMisuse@46/59 `self`->`r`