

def test_filter_by_translated_field(self):
    en = Normal.objects.language('en').get(pk=self.normal_id[1])
    translation_aware_manager = get_translation_aware_manager(Standard)
    with translation.override('en'):
        by_translated_field = translation_aware_manager.filter(normal__translated_field=en.translated_field)
        normals = [obj.normal.pk for obj in by_translated_field]
        expected = [en.pk]
        self.assertEqual(normals, expected)
        shared_fields = [obj.normal.shared_field for obj in by_translated_field]
        expected_fields = [en.shared_field]
        self.assertEqual(shared_fields, expected_fields)
        translated_fields = [obj.normal.translated_field for obj in by_translated_field]
        expected_fields = [en.translated_field]
        self.assertEqual(translated_fields, expected_fields)
        for obj in by_translated_field:
            self.assertTrue((obj in en.standards.all()))

dataset/ETHPy150Open KristianOellegaard/django-hvad/hvad/tests/related.py StandardToTransFKTest.test_filter_by_translated_field/original