summaryrefslogtreecommitdiff
path: root/tests/regressiontests/utils
diff options
context:
space:
mode:
authorLuke Plant <L.Plant.98@cantab.net>2010-01-05 12:06:45 +0000
committerLuke Plant <L.Plant.98@cantab.net>2010-01-05 12:06:45 +0000
commitbcef28349a52ff16c9c022b2722138ee9fe62a81 (patch)
treecc72874898a03366b7b115d1fe72b9df5c62f033 /tests/regressiontests/utils
parent4d6c66d4d8fa63005f8ca2d3fbae195922969d13 (diff)
Fixed #12506 - 'lazy' fails when there are multiple expected classes with the same method
Thanks to Alex for report and patch git-svn-id: http://code.djangoproject.com/svn/django/trunk@12104 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/utils')
-rw-r--r--tests/regressiontests/utils/functional.py10
-rw-r--r--tests/regressiontests/utils/tests.py1
2 files changed, 11 insertions, 0 deletions
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 fe5f463110..cd93fb9c01 100644
--- a/tests/regressiontests/utils/tests.py
+++ b/tests/regressiontests/utils/tests.py
@@ -12,6 +12,7 @@ import datastructures
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.