Permalink
Browse files

Fixed #13895 -- Refactored aggregation_regress doctests. Thanks to Al…

…ex Gaynor for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@13614 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent c2e3ba3 commit 1bf25e9bc6df6c2ae4c0b10fb839e101471e8373 @freakboy3742 freakboy3742 committed Aug 20, 2010
@@ -4,3 +4,4 @@
from django.test.client import Client
from django.test.testcases import TestCase, TransactionTestCase
+from django.test.utils import Approximate
View
@@ -1,11 +1,28 @@
-import sys, time, os
+import sys
+import time
+import os
from django.conf import settings
from django.core import mail
from django.core.mail.backends import locmem
from django.test import signals
from django.template import Template
from django.utils.translation import deactivate
+
+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 ContextList(list):
"""A wrapper that provides direct key access to context items contained
in a list of context objects.
@@ -2,24 +2,11 @@
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"]
Oops, something went wrong. Retry.

0 comments on commit 1bf25e9

Please sign in to comment.