diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-03-18 05:45:37 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-03-18 05:45:37 +0000 |
| commit | 6df9e25b618b603fb903f9e6c74e675aa2490305 (patch) | |
| tree | c12117aa403438246fa629286ae565ace7e8805e /tests | |
| parent | 133111e40b3afe20e80e5f12e3b064ba080c318d (diff) | |
queryset-refactor: Merged from trunk up to [7280]
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7281 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/modeltests/manipulators/models.py | 8 | ||||
| -rw-r--r-- | tests/regressiontests/i18n/misc.py | 11 | ||||
| -rw-r--r-- | tests/regressiontests/requests/tests.py | 4 | ||||
| -rw-r--r-- | tests/regressiontests/utils/decorators.py | 13 | ||||
| -rw-r--r-- | tests/regressiontests/utils/tests.py | 1 | ||||
| -rw-r--r-- | tests/regressiontests/utils/urls.py | 7 | ||||
| -rw-r--r-- | tests/regressiontests/utils/views.py | 10 | ||||
| -rw-r--r-- | tests/urls.py | 4 |
8 files changed, 51 insertions, 7 deletions
diff --git a/tests/modeltests/manipulators/models.py b/tests/modeltests/manipulators/models.py index 2ee81f62b3..c9b9848235 100644 --- a/tests/modeltests/manipulators/models.py +++ b/tests/modeltests/manipulators/models.py @@ -1,3 +1,4 @@ +# coding: utf-8 """ 27. Default manipulators @@ -21,7 +22,7 @@ class Album(models.Model): def __unicode__(self): return self.name -__test__ = {'API_TESTS':""" +__test__ = {'API_TESTS':u""" >>> from django.utils.datastructures import MultiValueDict # Create a Musician object via the default AddManipulator. @@ -88,4 +89,9 @@ True <Album: Ultimate Ella> >>> a2.release_date datetime.date(2005, 2, 13) + +# Test isValidFloat Unicode coercion +>>> from django.core.validators import isValidFloat, ValidationError +>>> try: isValidFloat(u"รค", None) +... except ValidationError: pass """} diff --git a/tests/regressiontests/i18n/misc.py b/tests/regressiontests/i18n/misc.py index 6ed8afaee3..f8f35ad4e4 100644 --- a/tests/regressiontests/i18n/misc.py +++ b/tests/regressiontests/i18n/misc.py @@ -87,11 +87,12 @@ source tree. 'es-ar' """ -# Python 2.3 returns slightly different results for completely bogus locales, -# so we omit this test for that anything below 2.4. It's relatively harmless in -# any cases (GIGO). This also means this won't be executed on Jython currently, -# but life's like that sometimes. -if sys.version_info >= (2, 4): +# Python 2.3 and 2.4 return slightly different results for completely bogus +# locales, so we omit this test for that anything below 2.4. It's relatively +# harmless in any cases (GIGO). This also means this won't be executed on +# Jython currently, but life's like that sometimes. (On those platforms, +# passing in a truly bogus locale will get you the default locale back.) +if sys.version_info >= (2, 5): tests += """ This test assumes there won't be a Django translation to a US variation of the Spanish language, a safe assumption. When the user sets it diff --git a/tests/regressiontests/requests/tests.py b/tests/regressiontests/requests/tests.py index f32ef14ae9..aaaef1d8b0 100644 --- a/tests/regressiontests/requests/tests.py +++ b/tests/regressiontests/requests/tests.py @@ -31,4 +31,8 @@ GET:{}, POST:{}, COOKIES:{}, META:{}> + +>>> from django.http import parse_cookie +>>> parse_cookie('invalid:key=true') +{} """ diff --git a/tests/regressiontests/utils/decorators.py b/tests/regressiontests/utils/decorators.py new file mode 100644 index 0000000000..c6ae243c98 --- /dev/null +++ b/tests/regressiontests/utils/decorators.py @@ -0,0 +1,13 @@ +from django.test import TestCase + +class DecoratorFromMiddlewareTests(TestCase): + """ + Tests for view decorators created using + ``django.utils.decorators.decorator_from_middleware``. + """ + + def test_process_view_middleware(self): + """ + Test a middleware that implements process_view. + """ + self.client.get('/utils/xview/') diff --git a/tests/regressiontests/utils/tests.py b/tests/regressiontests/utils/tests.py index abcd7212d8..6fc645505b 100644 --- a/tests/regressiontests/utils/tests.py +++ b/tests/regressiontests/utils/tests.py @@ -8,6 +8,7 @@ from django.utils import html, checksums import timesince import datastructures +from decorators import DecoratorFromMiddlewareTests # Extra tests __test__ = { diff --git a/tests/regressiontests/utils/urls.py b/tests/regressiontests/utils/urls.py new file mode 100644 index 0000000000..7b60d0884c --- /dev/null +++ b/tests/regressiontests/utils/urls.py @@ -0,0 +1,7 @@ +from django.conf.urls.defaults import * + +import views + +urlpatterns = patterns('', + (r'^xview/$', views.xview), +) diff --git a/tests/regressiontests/utils/views.py b/tests/regressiontests/utils/views.py new file mode 100644 index 0000000000..d22ae26641 --- /dev/null +++ b/tests/regressiontests/utils/views.py @@ -0,0 +1,10 @@ +from django.http import HttpResponse +from django.utils.decorators import decorator_from_middleware +from django.middleware.doc import XViewMiddleware + + +xview_dec = decorator_from_middleware(XViewMiddleware) + +def xview(request): + return HttpResponse() +xview = xview_dec(xview) diff --git a/tests/urls.py b/tests/urls.py index 174e06969b..41b4aaf6d3 100644 --- a/tests/urls.py +++ b/tests/urls.py @@ -11,10 +11,12 @@ urlpatterns = patterns('', # test urlconf for {% url %} template tag (r'^url_tag/', include('regressiontests.templates.urls')), - + # django built-in views (r'^views/', include('regressiontests.views.urls')), # test urlconf for middleware tests (r'^middleware/', include('regressiontests.middleware.urls')), + + (r'^utils/', include('regressiontests.utils.urls')), ) |
