Fixed some of the problems with aggregation_regress tests on higher levles of Postgres. Refs: #14246.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@13709 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Karen Tracey 2010-09-10 17:04:28 +00:00
parent 30610719d5
commit 30ad353718
1 changed files with 13 additions and 13 deletions

View File

@ -5,7 +5,7 @@ from django.core.exceptions import FieldError
from django.conf import settings
from django.test import TestCase, Approximate
from django.db import DEFAULT_DB_ALIAS
from django.db.models import Count, Max, Avg, Sum, F
from django.db.models import Count, Max, Avg, Sum, StdDev, Variance, F
from regressiontests.aggregation_regress.models import *
@ -623,60 +623,60 @@ class AggregationTests(TestCase):
def test_stddev(self):
self.assertEqual(
Book.objects.aggregate(StdDev('pages')),
{'pages__stddev': 311.46}
{'pages__stddev': Approximate(311.46, 1)}
)
self.assertEqual(
Book.objects.aggregate(StdDev('rating')),
{'rating__stddev': 0.60}
{'rating__stddev': Approximate(0.60, 1)}
)
self.assertEqual(
Book.objects.aggregate(StdDev('price')),
{'price__stddev': 24.16}
{'price__stddev': Approximate(24.16, 2)}
)
self.assertEqual(
Book.objects.aggregate(StdDev('pages', sample=True)),
{'pages__stddev': 341.19}
{'pages__stddev': Approximate(341.19, 2)}
)
self.assertEqual(
Book.objects.aggregate(StdDev('rating', sample=True)),
{'rating__stddev': 0.66}
{'rating__stddev': Approximate(0.66, 2)}
)
self.assertEqual(
Book.objects.aggregate(StdDev('price', sample=True)),
{'price__stddev': 26.46}
{'price__stddev': Approximate(26.46, 1)}
)
self.assertEqual(
Book.objects.aggregate(Variance('pages')),
{'pages__variance': 97010.80}
{'pages__variance': Approximate(97010.80, 1)}
)
self.assertEqual(
Book.objects.aggregate(Variance('rating')),
{'rating__variance': 0.36}
{'rating__variance': Approximate(0.36, 1)}
)
self.assertEqual(
Book.objects.aggregate(Variance('price')),
{'price__variance': 583.77}
{'price__variance': Approximate(583.77, 1)}
)
self.assertEqual(
Book.objects.aggregate(Variance('pages', sample=True)),
{'pages__variance': 116412.96}
{'pages__variance': Approximate(116412.96, 1)}
)
self.assertEqual(
Book.objects.aggregate(Variance('rating', sample=True)),
{'rating__variance': 0.44}
{'rating__variance': Approximate(0.44, 2)}
)
self.assertEqual(
Book.objects.aggregate(Variance('price', sample=True)),
{'price__variance': 700.53}
{'price__variance': Approximate(700.53, 2)}
)