mirror of
https://github.com/django/django.git
synced 2025-07-04 09:49:12 +00:00
boulder-oracle-sprint: Merged to [5392]
git-svn-id: http://code.djangoproject.com/svn/django/branches/boulder-oracle-sprint@5393 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
a82d071b48
commit
a62ee775ef
@ -237,7 +237,7 @@ class RegroupNode(Node):
|
|||||||
return ''
|
return ''
|
||||||
output = [] # list of dictionaries in the format {'grouper': 'key', 'list': [list of contents]}
|
output = [] # list of dictionaries in the format {'grouper': 'key', 'list': [list of contents]}
|
||||||
for obj in obj_list:
|
for obj in obj_list:
|
||||||
grouper = self.expression.resolve(Context({'var': obj}), True)
|
grouper = self.expression.resolve(obj, True)
|
||||||
# TODO: Is this a sensible way to determine equality?
|
# TODO: Is this a sensible way to determine equality?
|
||||||
if output and repr(output[-1]['grouper']) == repr(grouper):
|
if output and repr(output[-1]['grouper']) == repr(grouper):
|
||||||
output[-1]['list'].append(obj)
|
output[-1]['list'].append(obj)
|
||||||
@ -847,7 +847,7 @@ def regroup(parser, token):
|
|||||||
if lastbits_reversed[1][::-1] != 'as':
|
if lastbits_reversed[1][::-1] != 'as':
|
||||||
raise TemplateSyntaxError, "next-to-last argument to 'regroup' tag must be 'as'"
|
raise TemplateSyntaxError, "next-to-last argument to 'regroup' tag must be 'as'"
|
||||||
|
|
||||||
expression = parser.compile_filter('var.%s' % lastbits_reversed[2][::-1])
|
expression = parser.compile_filter(lastbits_reversed[2][::-1])
|
||||||
|
|
||||||
var_name = lastbits_reversed[0][::-1]
|
var_name = lastbits_reversed[0][::-1]
|
||||||
return RegroupNode(target, expression, var_name)
|
return RegroupNode(target, expression, var_name)
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
# This is a slightly modified version of the doctest.py that shipped with Python 2.4
|
||||||
|
# It incorporates changes that have been submitted the the Python ticket tracker
|
||||||
|
# as ticket #1521051. These changes allow for a DoctestRunner and Doctest base
|
||||||
|
# class to be specified when constructing a DoctestSuite.
|
||||||
|
|
||||||
# Module doctest.
|
# Module doctest.
|
||||||
# Released to the public domain 16-Jan-2001, by Tim Peters (tim@python.org).
|
# Released to the public domain 16-Jan-2001, by Tim Peters (tim@python.org).
|
||||||
# Major enhancements and refactoring by:
|
# Major enhancements and refactoring by:
|
@ -1,5 +1,6 @@
|
|||||||
import unittest, doctest
|
import unittest
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.test import _doctest as doctest
|
||||||
from django.test.utils import setup_test_environment, teardown_test_environment
|
from django.test.utils import setup_test_environment, teardown_test_environment
|
||||||
from django.test.utils import create_test_db, destroy_test_db
|
from django.test.utils import create_test_db, destroy_test_db
|
||||||
from django.test.testcases import OutputChecker, DocTestRunner
|
from django.test.testcases import OutputChecker, DocTestRunner
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import re, doctest, unittest
|
import re, unittest
|
||||||
from urlparse import urlparse
|
from urlparse import urlparse
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
from django.core import management, mail
|
from django.core import management, mail
|
||||||
from django.db.models import get_apps
|
from django.db.models import get_apps
|
||||||
|
from django.test import _doctest as doctest
|
||||||
from django.test.client import Client
|
from django.test.client import Client
|
||||||
|
|
||||||
normalize_long_ints = lambda s: re.sub(r'(?<![\w])(\d+)L(?![\w])', '\\1', s)
|
normalize_long_ints = lambda s: re.sub(r'(?<![\w])(\d+)L(?![\w])', '\\1', s)
|
||||||
|
@ -147,7 +147,7 @@ doctests or unit tests are right for you.
|
|||||||
If you've been using Python for a while, ``doctest`` will probably feel more
|
If you've been using Python for a while, ``doctest`` will probably feel more
|
||||||
"pythonic". It's designed to make writing tests as easy as possible, so
|
"pythonic". It's designed to make writing tests as easy as possible, so
|
||||||
there's no overhead of writing classes or methods; you simply put tests in
|
there's no overhead of writing classes or methods; you simply put tests in
|
||||||
docstrings. This gives the added advantage of given your modules automatic
|
docstrings. This gives the added advantage of giving your modules automatic
|
||||||
documentation -- well-written doctests can kill both the documentation and the
|
documentation -- well-written doctests can kill both the documentation and the
|
||||||
testing bird with a single stone.
|
testing bird with a single stone.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user