Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#12948 closed (fixed)

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

Reported by: kmtracey 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: UI/UX:


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 6 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 6 years ago by coleifer

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to coleifer
  • Patch needs improvement unset
  • Status changed from new to assigned

comment:2 Changed 6 years ago by coleifer

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

Changed 6 years ago by coleifer

comment:3 Changed 6 years ago by Alex

  • Component changed from Uncategorized to Database layer (models, ORM)
  • Triage Stage changed from Unreviewed to Ready for checkin

comment:4 Changed 6 years ago by jkocherhans

  • Resolution set to fixed
  • Status changed from assigned to closed

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

comment:5 Changed 5 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

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