diff options
| author | Carl Meyer <carl@oddbird.net> | 2010-10-09 20:07:48 +0000 |
|---|---|---|
| committer | Carl Meyer <carl@oddbird.net> | 2010-10-09 20:07:48 +0000 |
| commit | 1fe1af93a51f10be832704ec96efc8e2ba277b3e (patch) | |
| tree | 984111aa9d7d715836c2357d5e5b491c01ba9921 /tests | |
| parent | ed975755d2afa24f11fe01137f49055f14d2fcd9 (diff) | |
Added sanity-checking of annotation alias names.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14092 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/aggregation_regress/tests.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/regressiontests/aggregation_regress/tests.py b/tests/regressiontests/aggregation_regress/tests.py index 51f439c5a1..786431420d 100644 --- a/tests/regressiontests/aggregation_regress/tests.py +++ b/tests/regressiontests/aggregation_regress/tests.py @@ -481,6 +481,14 @@ class AggregationTests(TestCase): lambda b: b.name ) + def test_duplicate_alias(self): + # Regression for #11256 - duplicating a default alias raises ValueError. + self.assertRaises(ValueError, Book.objects.all().annotate, Avg('authors__age'), authors__age__avg=Avg('authors__age')) + + def test_field_name_conflict(self): + # Regression for #11256 - providing an aggregate name that conflicts with a field name on the model raises ValueError + self.assertRaises(ValueError, Author.objects.annotate, age=Avg('friends__age')) + def test_pickle(self): # Regression for #10197 -- Queries with aggregates can be pickled. # First check that pickling is possible at all. No crash = success |
