Commits

Anonymous committed e88b163

[1.2.X] Fixed some of the problems with aggregation_regress tests on higher levles of Postgres. Refs #14246.

r13709 from trunk.

Comments (0)

Files changed (1)

tests/regressiontests/aggregation_regress/tests.py

 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 *
 
         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)}
             )