Ticket #17564: 17564-test.diff

File 17564-test.diff, 3.0 KB (added by Claude Paroz, 13 years ago)

Test showing failure

  • tests/regressiontests/aggregation_regress/fixtures/aggregation_regress.json

    diff --git a/tests/regressiontests/aggregation_regress/fixtures/aggregation_regress.json b/tests/regressiontests/aggregation_regress/fixtures/aggregation_regress.json
    index 597ac04..f858643 100644
    a b  
    165165        "fields": {
    166166            "age": 34,
    167167            "friends": [2, 4],
     168            "living": true,
    168169            "name": "Adrian Holovaty"
    169170        }
    170171    },
     
    174175        "fields": {
    175176            "age": 35,
    176177            "friends": [1, 7],
     178            "living": true,
    177179            "name": "Jacob Kaplan-Moss"
    178180        }
    179181    },
     
    183185        "fields": {
    184186            "age": 45,
    185187            "friends": [],
     188            "living": true,
    186189            "name": "Brad Dayley"
    187190        }
    188191    },
     
    192195        "fields": {
    193196            "age": 29,
    194197            "friends": [1],
     198            "living": true,
    195199            "name": "James Bennett"
    196200        }
    197201    },
     
    201205        "fields": {
    202206            "age": 37,
    203207            "friends": [6, 7],
     208            "living": true,
    204209            "name": "Jeffrey Forcier"
    205210        }
    206211    },
     
    210215        "fields": {
    211216            "age": 29,
    212217            "friends": [5, 7],
     218            "living": true,
    213219            "name": "Paul Bissex"
    214220        }
    215221    },
     
    219225        "fields": {
    220226            "age": 25,
    221227            "friends": [2, 5, 6],
     228            "living": true,
    222229            "name": "Wesley J. Chun"
    223230        }
    224231    },
     
    228235        "fields": {
    229236            "age": 57,
    230237            "friends": [9],
     238            "living": true,
    231239            "name": "Peter Norvig"
    232240        }
    233241    },
     
    237245        "fields": {
    238246            "age": 46,
    239247            "friends": [8],
     248            "living": true,
    240249            "name": "Stuart Russell"
    241250        }
    242251    },
  • tests/regressiontests/aggregation_regress/models.py

    diff --git a/tests/regressiontests/aggregation_regress/models.py b/tests/regressiontests/aggregation_regress/models.py
    index ccef9a5..66335d3 100644
    a b class Author(models.Model):  
    66    name = models.CharField(max_length=100)
    77    age = models.IntegerField()
    88    friends = models.ManyToManyField('self', blank=True)
     9    living = models.BooleanField(default=True)
    910
    1011    def __unicode__(self):
    1112        return self.name
  • tests/regressiontests/aggregation_regress/tests.py

    diff --git a/tests/regressiontests/aggregation_regress/tests.py b/tests/regressiontests/aggregation_regress/tests.py
    index 36a54c0..bec181e 100644
    a b class AggregationTests(TestCase):  
    865865            ['Peter Norvig'],
    866866            lambda b: b.name
    867867        )
     868
     869    def test_sum_on_boolean(self):
     870        qs = Author.objects.aggregate(Sum('living'))
     871        self.assertEqual(qs, {'living__sum': 9})
Back to Top