Opened 15 years ago

Closed 15 years ago

Last modified 13 years ago

#12948 closed (fixed)

Test added in r12505 fails for older Pythons & non-sqlite DBs

Reported by: Karen Tracey Owned by: coleifer
Component: Database layer (models, ORM) Version: 1.1
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Running with Python 2.5 (or lower) and MySQL (or Postgres or Oracle), failure is:

======================================================================
FAIL: Doctest: modeltests.aggregation.models.__test__.API_TESTS
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/kmt/django/trunk/django/test/_doctest.py", line 2180, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for modeltests.aggregation.models.__test__.API_TESTS
  File "/home/kmt/django/trunk/tests/modeltests/aggregation/models.py", line unknown line number, in API_TESTS

----------------------------------------------------------------------
File "/home/kmt/django/trunk/tests/modeltests/aggregation/models.py", line ?, in modeltests.aggregation.models.__test__.
API_TESTS
Failed example:
    Book.objects.values_list('price').annotate(count=Count('price')).order_by('-count', 'price')
Expected:
    [(Decimal('29.69'), 2), (Decimal('23.09'), 1), (Decimal('30'), 1), (Decimal('75'), 1), (Decimal('82.8'), 1)]
Got:
    [(Decimal("29.69"), 2), (Decimal("23.09"), 1), (Decimal("30.00"), 1), (Decimal("75.00"), 1), (Decimal("82.80"), 1)]


----------------------------------------------------------------------
Ran 1 test in 1.683s

FAILED (failures=1)

Decimal repr changed to use single quotes in Python 2.6, and these other DBs apparently consistently return two digits after the decimal place, even when they are 0.

Attachments (1)

12948.diff (804 bytes ) - added by coleifer 15 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 by coleifer, 15 years ago

Has patch: set
Owner: changed from nobody to coleifer
Status: newassigned

comment:2 by coleifer, 15 years ago

I messed this one up, apparently the diferent backends return different precision decimal bits. this fixes.

by coleifer, 15 years ago

Attachment: 12948.diff added

comment:3 by Alex Gaynor, 15 years ago

Component: UncategorizedDatabase layer (models, ORM)
Triage Stage: UnreviewedReady for checkin

comment:4 by jkocherhans, 15 years ago

Resolution: fixed
Status: assignedclosed

(In [12551]) Fixed #12948. Removed a test dependency on the formatting of Decimals. Thanks, coleifer.

comment:5 by Jacob, 13 years ago

milestone: 1.2

Milestone 1.2 deleted

Note: See TracTickets for help on using tickets.
Back to Top