def test_select_related_with_null_relation(self):
        with translation.override('en'):
            # First, two Normal objects are created by TwoTranslatedNormalMixin (in English and Japanese)
            related1 = Related.objects.language().create(normal=self.normal1, translated=self.normal1)
            # Now we create another, but with relations set to None:
            related2 = Related.objects.language().create(normal=None, translated=None)

            with self.assertNumQueries(1):
                rel_objects = Related.objects.language().select_related('normal', 'translated')
                #print(rel_objects.query) # Note: uncommenting this line causes the test to fail, which shouldn't happen :-()
                self.assertEqual(len(rel_objects), 2)
                for r in rel_objects:
                    if (r.id == related1.id):
                        self.assertEqual(self.normal1.translated_field, r.normal.translated_field)
                        self.assertEqual(self.normal1.translated_field, r.translated.translated_field)
                    elif (r.id == related2.id):
                        self.assertEqual(r.normal, None)
                        self.assertEqual(r.translated, None)
                    else:
                        self.fail("Invalid Related object; ID is %s" % r.id)
dataset/ETHPy150Open KristianOellegaard/django-hvad/hvad/tests/related.py/SelectRelatedTests.test_select_related_with_null_relation/original