﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
14246	aggregation_regress tests don't run on Postgres that supports StdDev	Karen Tracey	nobody	"Since being refactored unit tests (r13614/r13615), aggregation_regress tests fail on sufficiently high levels of Postgres:

{{{
Creating table aggregation_regress_hardbackbook
Installing custom SQL ...
Installing indexes ...
Installed 25 object(s) from 1 fixture(s)
test_aggrate_annotation (regressiontests.aggregation_regress.tests.AggregationTests) ... ok
test_aggregate (regressiontests.aggregation_regress.tests.AggregationTests) ... ok
test_aggregate_fexpr (regressiontests.aggregation_regress.tests.AggregationTests) ... ok
test_aggregates_in_where_clause (regressiontests.aggregation_regress.tests.AggregationTests) ... ok
test_aggregates_in_where_clause_pre_eval (regressiontests.aggregation_regress.tests.AggregationTests) ... ok
test_annotate_with_extra (regressiontests.aggregation_regress.tests.AggregationTests) ... ok
test_annotation (regressiontests.aggregation_regress.tests.AggregationTests) ... FAIL
test_db_col_table (regressiontests.aggregation_regress.tests.AggregationTests) ... ok
test_empty (regressiontests.aggregation_regress.tests.AggregationTests) ... ok
test_field_error (regressiontests.aggregation_regress.tests.AggregationTests) ... ok
test_more (regressiontests.aggregation_regress.tests.AggregationTests) ... ok
test_more_more (regressiontests.aggregation_regress.tests.AggregationTests) ... ok
test_more_more_more (regressiontests.aggregation_regress.tests.AggregationTests) ... ok
test_pickle (regressiontests.aggregation_regress.tests.AggregationTests) ... ok
test_stddev (regressiontests.aggregation_regress.tests.AggregationTests) ... ERROR

======================================================================
ERROR: test_stddev (regressiontests.aggregation_regress.tests.AggregationTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File ""/home/kmtracey/django/hgclone/tests/regressiontests/aggregation_regress/tests.py"", line 625, in test_stddev
    Book.objects.aggregate(StdDev('pages')),
NameError: global name 'StdDev' is not defined

======================================================================
FAIL: test_annotation (regressiontests.aggregation_regress.tests.AggregationTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File ""/home/kmtracey/django/hgclone/tests/regressiontests/aggregation_regress/tests.py"", line 145, in test_annotation
    rating=3.0
  File ""/home/kmtracey/django/hgclone/tests/regressiontests/aggregation_regress/tests.py"", line 35, in assertObjectAttrs
    self.assertEqual(getattr(obj, attr), value)
AssertionError: Decimal('11.545') != 11.545

----------------------------------------------------------------------
Ran 15 tests in 0.342s

FAILED (failures=1, errors=1)
Destroying test database 'default'...
Destroying test database 'other'...

}}}

Partial fix attached, which imports !StdDev and Variance and sprinkles Approximate as needed. It would be good if someone who understands how Approximate is supposed to be used took a look, since it's not immediately obvious to me...the values supplied for `places` here are sometimes smaller than I would have thought they should be, but they are what is needed to get the tests to pass on my machine.

Also still needed is understanding of the `test_annotation` failure."		closed	Uncategorized	1.2		fixed			Unreviewed	1	0	0	0	0	0
