Ticket #15040: 15040-anon-test.diff

File 15040-anon-test.diff, 1.1 KB (added by Tim Graham, 11 years ago)
  • tests/defer_regress/models.py

    diff --git a/tests/defer_regress/models.py b/tests/defer_regress/models.py
    index 0170221..6192557 100644
    a b class Proxy(Item):  
    4545class SimpleItem(models.Model):
    4646    name = models.CharField(max_length=15)
    4747    value = models.IntegerField()
     48    active = models.BooleanField(default=True)
    4849
    4950    def __str__(self):
    5051        return self.name
  • tests/defer_regress/tests.py

    diff --git a/tests/defer_regress/tests.py b/tests/defer_regress/tests.py
    index ffb47a8..97d718e 100644
    a b class DeferRegressionTest(TestCase):  
    230230        feature = Feature.objects.create(item=item)
    231231        SpecialFeature.objects.create(feature=feature)
    232232
    233         qs = Feature.objects.only('item__name').select_related('item')
     233        qs = Feature.objects.only('item__name', 'item__active').select_related('item')
    234234        self.assertEqual(len(qs), 1)
     235        self.assertEqual(qs[0].item.active, True)
    235236
    236237        qs = SpecialFeature.objects.only('feature__item__name').select_related('feature__item')
    237238        self.assertEqual(len(qs), 1)
Back to Top