def test_select_related(self):
        bmt = BooleanModel.objects.create(bfield=True)
        bmf = BooleanModel.objects.create(bfield=False)
        nbmt = NullBooleanModel.objects.create(nbfield=True)
        nbmf = NullBooleanModel.objects.create(nbfield=False)
        m1 = FksToBooleans.objects.create(bf=bmt, nbf=nbmt)
        m2 = FksToBooleans.objects.create(bf=bmf, nbf=nbmf)

        # select_related('fk_field_name')
        ma = FksToBooleans.objects.select_related('bf').get(pk=m1.id)
        self.assertEqual(ma.bf.bfield, True)
        self.assertEqual(ma.nbf.nbfield, True)

        # select_related()
        mb = FksToBooleans.objects.select_related().get(pk=m1.id)
        mc = FksToBooleans.objects.select_related().get(pk=m2.id)
        self.assertEqual(mb.bf.bfield, True)
        self.assertEqual(mb.nbf.nbfield, True)
        self.assertEqual(mc.bf.bfield, False)
        self.assertEqual(mc.nbf.nbfield, False)
Boolean fields retrieved via select_related() should return booleans.
dataset/ETHPy150Open django/django/tests/model_fields/test_booleanfield.py/BooleanFieldTests.test_select_related