From 3de16688a93d64154dea1f5517d3e9e80b97b080 Mon Sep 17 00:00:00 2001 From: Luke Plant Date: Tue, 5 Jan 2010 13:20:19 +0000 Subject: [1.1.X] Fixed #12506 - 'lazy' fails when there are multiple expected classes with the same method Thanks to Alex for report and patch Backport of r12104 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12105 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/regressiontests/utils/functional.py | 10 ++++++++++ tests/regressiontests/utils/tests.py | 1 + 2 files changed, 11 insertions(+) create mode 100644 tests/regressiontests/utils/functional.py (limited to 'tests') diff --git a/tests/regressiontests/utils/functional.py b/tests/regressiontests/utils/functional.py new file mode 100644 index 0000000000..72610154d8 --- /dev/null +++ b/tests/regressiontests/utils/functional.py @@ -0,0 +1,10 @@ +from unittest import TestCase + +from django.utils.functional import lazy + + +class FunctionalTestCase(TestCase): + def test_lazy(self): + t = lazy(lambda: tuple(range(3)), list, tuple) + for a, b in zip(t(), range(3)): + self.assertEqual(a, b) diff --git a/tests/regressiontests/utils/tests.py b/tests/regressiontests/utils/tests.py index 6258b81200..d51fa13fd8 100644 --- a/tests/regressiontests/utils/tests.py +++ b/tests/regressiontests/utils/tests.py @@ -12,6 +12,7 @@ import datastructures import dateformat import itercompat from decorators import DecoratorFromMiddlewareTests +from functional import FunctionalTestCase # We need this because "datastructures" uses sorted() and the tests are run in # the scope of this module. -- cgit v1.3