mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
Fixed #13895 -- Refactored aggregation_regress doctests. Thanks to Alex Gaynor for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13614 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
c2e3ba3ba0
commit
1bf25e9bc6
5 changed files with 639 additions and 333 deletions
|
@ -2,24 +2,11 @@ import datetime
|
|||
from decimal import Decimal
|
||||
|
||||
from django.db.models import Avg, Sum, Count, Max, Min
|
||||
from django.test import TestCase
|
||||
from django.test import TestCase, Approximate
|
||||
|
||||
from models import Author, Publisher, Book, Store
|
||||
|
||||
|
||||
class Approximate(object):
|
||||
def __init__(self, val, places=7):
|
||||
self.val = val
|
||||
self.places = places
|
||||
|
||||
def __repr__(self):
|
||||
return repr(self.val)
|
||||
|
||||
def __eq__(self, other):
|
||||
if self.val == other:
|
||||
return True
|
||||
return round(abs(self.val-other), self.places) == 0
|
||||
|
||||
class BaseAggregateTestCase(TestCase):
|
||||
fixtures = ["initial_data.json"]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue