1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +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:
Russell Keith-Magee
2010-08-20 14:28:42 +00:00
parent c2e3ba3ba0
commit 1bf25e9bc6
5 changed files with 639 additions and 333 deletions

View File

@@ -4,3 +4,4 @@ Django Unit Test and Doctest framework.
from django.test.client import Client
from django.test.testcases import TestCase, TransactionTestCase
from django.test.utils import Approximate

View File

@@ -1,4 +1,6 @@
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
@@ -6,6 +8,21 @@ 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.