Ticket #14246: aggregation_regress.diff
File aggregation_regress.diff, 3.2 KB (added by , 14 years ago) |
---|
-
tests/regressiontests/aggregation_regress/tests.py
5 5 from django.conf import settings 6 6 from django.test import TestCase, Approximate 7 7 from django.db import DEFAULT_DB_ALIAS 8 from django.db.models import Count, Max, Avg, Sum, F8 from django.db.models import Count, Max, Avg, Sum, StdDev, Variance, F 9 9 10 10 from regressiontests.aggregation_regress.models import * 11 11 … … 623 623 def test_stddev(self): 624 624 self.assertEqual( 625 625 Book.objects.aggregate(StdDev('pages')), 626 {'pages__stddev': 311.46}626 {'pages__stddev': Approximate(311.46, 1)} 627 627 ) 628 628 629 629 self.assertEqual( 630 630 Book.objects.aggregate(StdDev('rating')), 631 {'rating__stddev': 0.60}631 {'rating__stddev': Approximate(0.60, 1)} 632 632 ) 633 633 634 634 self.assertEqual( 635 635 Book.objects.aggregate(StdDev('price')), 636 {'price__stddev': 24.16}636 {'price__stddev': Approximate(24.16, 2)} 637 637 ) 638 638 639 639 self.assertEqual( 640 640 Book.objects.aggregate(StdDev('pages', sample=True)), 641 {'pages__stddev': 341.19}641 {'pages__stddev': Approximate(341.19, 2)} 642 642 ) 643 643 644 644 self.assertEqual( 645 645 Book.objects.aggregate(StdDev('rating', sample=True)), 646 {'rating__stddev': 0.66}646 {'rating__stddev': Approximate(0.66, 2)} 647 647 ) 648 648 649 649 self.assertEqual( 650 650 Book.objects.aggregate(StdDev('price', sample=True)), 651 {'price__stddev': 26.46}651 {'price__stddev': Approximate(26.46, 1)} 652 652 ) 653 653 654 654 self.assertEqual( 655 655 Book.objects.aggregate(Variance('pages')), 656 {'pages__variance': 97010.80}656 {'pages__variance': Approximate(97010.80, 1)} 657 657 ) 658 658 659 659 self.assertEqual( 660 660 Book.objects.aggregate(Variance('rating')), 661 {'rating__variance': 0.36}661 {'rating__variance': Approximate(0.36, 1)} 662 662 ) 663 663 664 664 self.assertEqual( 665 665 Book.objects.aggregate(Variance('price')), 666 {'price__variance': 583.77}666 {'price__variance': Approximate(583.77, 1)} 667 667 ) 668 668 669 669 self.assertEqual( 670 670 Book.objects.aggregate(Variance('pages', sample=True)), 671 {'pages__variance': 116412.96}671 {'pages__variance': Approximate(116412.96, 1)} 672 672 ) 673 673 674 674 self.assertEqual( 675 675 Book.objects.aggregate(Variance('rating', sample=True)), 676 {'rating__variance': 0.44}676 {'rating__variance': Approximate(0.44, 2)} 677 677 ) 678 678 679 679 self.assertEqual( 680 680 Book.objects.aggregate(Variance('price', sample=True)), 681 {'price__variance': 700.53}681 {'price__variance': Approximate(700.53, 2)} 682 682 )