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:
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user