mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
[1.2.X] Fixed #13895 -- Refactored aggregation_regress doctests. Thanks to Alex Gaynor for the patch.
Backport of r13614 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@13615 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -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"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user