Opened 9 years ago

Closed 9 years ago

Last modified 7 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


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/", 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/", line unknown line number, in API_TESTS

File "/home/kmt/django/trunk/tests/modeltests/aggregation/", line ?, in modeltests.aggregation.models.__test__.
Failed example:
    Book.objects.values_list('price').annotate(count=Count('price')).order_by('-count', 'price')
    [(Decimal('29.69'), 2), (Decimal('23.09'), 1), (Decimal('30'), 1), (Decimal('75'), 1), (Decimal('82.8'), 1)]
    [(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 9 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 9 years ago by coleifer

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

comment:2 Changed 9 years ago by coleifer

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

Changed 9 years ago by coleifer

Attachment: 12948.diff added

comment:3 Changed 9 years ago by Alex Gaynor

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

comment:4 Changed 9 years ago by jkocherhans

Resolution: fixed
Status: assignedclosed

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

comment:5 Changed 7 years ago by Jacob

milestone: 1.2

Milestone 1.2 deleted

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